Giter Club home page Giter Club logo

Comments (4)

bkiers avatar bkiers commented on June 17, 2024

Hi,

Yes, good catch.

This ambiguity can easily be resolved by ANTLR4's so called "tree-labels". Checkout this Q&A on stackoverflow to see what "tree-labels" are, and how they can be used: http://stackoverflow.com/questions/14565794/antlr-4-tree-inject-rewrite-operator

The ICalendar grammar I presented here was only a (more or less) 1-on-1 translation of the official RFC. Besides what you just pointed out, I'm pretty sure there are more things that could be improved.

For the time being, I'll leave this issue open, maybe I'll improve the grammar with these "tree-labels" in the near future.

Cheers,

Bart.

from icalparser.

wealdtech avatar wealdtech commented on June 17, 2024

Interesting. Given that this just seems to be a case of the spec not bothering to define interval and count separately, wouldn't it be easier to do something like:

recur_rule_part
: k_freq ASSIGN freq
| k_until ASSIGN enddate
| k_count ASSIGN count
| k_interval ASSIGN interval
| k_bysecond ASSIGN byseclist
| k_byminute ASSIGN byminlist
| k_byhour ASSIGN byhrlist
| k_byday ASSIGN bywdaylist
| k_bymonthday ASSIGN bymodaylist
| k_byyearday ASSIGN byyrdaylist
| k_byweekno ASSIGN bywknolist
| k_bymonth ASSIGN bymolist
| k_bysetpos ASSIGN bysplist
| k_wkst ASSIGN weekday
;

count
: digits
;

interval
: digits
;

Or is there some reason to not do it this way?

from icalparser.

bkiers avatar bkiers commented on June 17, 2024

Yes, that is also a valid option.

from icalparser.

wealdtech avatar wealdtech commented on June 17, 2024

I've altered my fork of this to handle this situation, pull request should be attached if you so desire.

from icalparser.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.