diff options
Diffstat (limited to '')
| -rwxr-xr-x | src/yuescript/yue_parser.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index ef700ae..07fcd27 100755 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
| @@ -50,21 +50,22 @@ YueParser::YueParser() { | |||
| 50 | EmptyLine = SpaceBreak; | 50 | EmptyLine = SpaceBreak; |
| 51 | AlphaNum = range('a', 'z') | range('A', 'Z') | range('0', '9') | '_'; | 51 | AlphaNum = range('a', 'z') | range('A', 'Z') | range('0', '9') | '_'; |
| 52 | Name = (range('a', 'z') | range('A', 'Z') | '_') >> *AlphaNum; | 52 | Name = (range('a', 'z') | range('A', 'Z') | '_') >> *AlphaNum; |
| 53 | num_expo = set("eE") >> -expr('-') >> +range('0', '9'); | 53 | num_expo = set("eE") >> -expr('-') >> num_char; |
| 54 | lj_num = -set("uU") >> set("lL") >> set("lL"); | 54 | lj_num = -set("uU") >> set("lL") >> set("lL"); |
| 55 | num_char = range('0', '9') >> *(range('0', '9') | expr('_') >> and_(range('0', '9'))); | ||
| 56 | num_char_hex = range('0', '9') | range('a', 'f') | range('A', 'F'); | ||
| 57 | num_lit = num_char_hex >> *(num_char_hex | expr('_') >> and_(num_char_hex)); | ||
| 55 | Num = ( | 58 | Num = ( |
| 56 | "0x" >> | 59 | "0x" >> +num_lit >> -lj_num |
| 57 | +(range('0', '9') | range('a', 'f') | range('A', 'F')) >> | ||
| 58 | -lj_num | ||
| 59 | ) | ( | 60 | ) | ( |
| 60 | +range('0', '9') >> ( | 61 | +num_char >> ( |
| 61 | '.' >> +range('0', '9') >> -num_expo | | 62 | '.' >> +num_char >> -num_expo | |
| 62 | num_expo | | 63 | num_expo | |
| 63 | lj_num | | 64 | lj_num | |
| 64 | true_() | 65 | true_() |
| 65 | ) | 66 | ) |
| 66 | ) | ( | 67 | ) | ( |
| 67 | '.' >> +range('0', '9') >> -num_expo | 68 | '.' >> +num_char >> -num_expo |
| 68 | ); | 69 | ); |
| 69 | 70 | ||
| 70 | Cut = false_(); | 71 | Cut = false_(); |
| @@ -640,6 +641,7 @@ YueParser::YueParser() { | |||
| 640 | ExpListAssign = ExpList >> -(Update | Assign); | 641 | ExpListAssign = ExpList >> -(Update | Assign); |
| 641 | 642 | ||
| 642 | if_line = Space >> IfType >> IfCond; | 643 | if_line = Space >> IfType >> IfCond; |
| 644 | while_line = Space >> WhileType >> Exp; | ||
| 643 | 645 | ||
| 644 | YueLineComment = *(not_(set("\r\n")) >> Any); | 646 | YueLineComment = *(not_(set("\r\n")) >> Any); |
| 645 | yue_line_comment = expr("--") >> YueLineComment >> and_(Stop); | 647 | yue_line_comment = expr("--") >> YueLineComment >> and_(Stop); |
| @@ -647,7 +649,7 @@ YueParser::YueParser() { | |||
| 647 | yue_multiline_comment = multi_line_open >> YueMultilineComment >> multi_line_close; | 649 | yue_multiline_comment = multi_line_open >> YueMultilineComment >> multi_line_close; |
| 648 | yue_comment = check_indent >> (yue_multiline_comment >> *(set(" \t") | yue_multiline_comment) >> -yue_line_comment | yue_line_comment) >> and_(Break); | 650 | yue_comment = check_indent >> (yue_multiline_comment >> *(set(" \t") | yue_multiline_comment) >> -yue_line_comment | yue_line_comment) >> and_(Break); |
| 649 | 651 | ||
| 650 | statement_appendix = (if_line | CompInner) >> Space; | 652 | statement_appendix = (if_line | while_line | CompInner) >> Space; |
| 651 | statement_sep = and_(*SpaceBreak >> CheckIndent >> Space >> (set("($'\"") | expr("[[") | expr("[="))); | 653 | statement_sep = and_(*SpaceBreak >> CheckIndent >> Space >> (set("($'\"") | expr("[[") | expr("[="))); |
| 652 | Statement = Seperator >> -(yue_comment >> *(Break >> yue_comment) >> Break >> CheckIndent) >> Space >> ( | 654 | Statement = Seperator >> -(yue_comment >> *(Break >> yue_comment) >> Break >> CheckIndent) >> Space >> ( |
| 653 | Import | While | Repeat | For | ForEach | | 655 | Import | While | Repeat | For | ForEach | |
