Skip to content

Commit

Permalink
More comples NUMBER definition
Browse files Browse the repository at this point in the history
INTEGER, DECIMAL, DOUBLE with EXPONENT
  • Loading branch information
lszeremeta committed Aug 17, 2020
1 parent 5f76cb5 commit d25073a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
10 changes: 7 additions & 3 deletions other-notations/YARSpg.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,13 @@ SECTION_NAME
| 'EDGES'
COMMENT ::= '#' [^#xd#xa#xc]*
STRING ::= STRING_LITERAL_QUOTE
NUMBER ::= SIGN? [0-9]+ '.'? [0-9]*
NUMBER ::= INTEGER
| DECIMAL
| DOUBLE
INTEGER ::= SIGN? [0-9]+
DECIMAL ::= SIGN? [0-9]* '.' [0-9]+
DOUBLE ::= SIGN? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT)
EXPONENT ::= [eE] SIGN? [0-9]+
BOOL ::= 'true'
| 'false'
DATETYPE ::= DATETIME
Expand All @@ -157,8 +163,6 @@ TIME ::= [0-9] [0-9] ':' [0-9] [0-9] ':' [0-9] [0-9] TIMEZONE?
TIMEZONE ::= SIGN? [0-9] [0-9] ':' [0-9] [0-9]
DATETIME
::= DATE 'T' TIME
SIGN ::= '+'
| '-'
STRING_LITERAL_QUOTE
::= '"' ([^"\#xd#xa] | "'" | '\"')* '"'
ALNUM_PLUS
Expand Down
20 changes: 19 additions & 1 deletion yarspg/YARSpg.g4
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,27 @@ STRING
;

NUMBER
: SIGN? [0-9]+'.'?[0-9]*
: INTEGER
| DECIMAL
| DOUBLE
;

INTEGER
: SIGN? [0-9]+
;

DECIMAL
: SIGN? [0-9]* '.' [0-9]+
;

DOUBLE
: SIGN? ([0-9]+ '.' [0-9]* EXPONENT | '.' [0-9]+ EXPONENT | [0-9]+ EXPONENT)
;

EXPONENT
: [eE] SIGN? [0-9]+
;

BOOL
: 'true'
| 'false'
Expand Down

0 comments on commit d25073a

Please sign in to comment.