diff options
| author | Li Jin <dragon-fly@qq.com> | 2022-12-02 10:15:09 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2022-12-02 10:15:09 +0800 |
| commit | a6a65ba26a9d320611abcbfba49fa724edfb4dad (patch) | |
| tree | 8e51410485a1f7a6108d87eb608aeae1a632add6 | |
| parent | 44069ba29baf423d73e0d2752f0abc7df46fbbb6 (diff) | |
| download | yuescript-a6a65ba26a9d320611abcbfba49fa724edfb4dad.tar.gz yuescript-a6a65ba26a9d320611abcbfba49fa724edfb4dad.tar.bz2 yuescript-a6a65ba26a9d320611abcbfba49fa724edfb4dad.zip | |
add more num lit specs.
Diffstat (limited to '')
| -rw-r--r-- | spec/inputs/literals.yue | 3 | ||||
| -rw-r--r-- | spec/outputs/literals.lua | 3 | ||||
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
| -rw-r--r-- | src/yuescript/yue_parser.cpp | 20 |
4 files changed, 18 insertions, 10 deletions
diff --git a/spec/inputs/literals.yue b/spec/inputs/literals.yue index 8b81fde..ef8b5f1 100644 --- a/spec/inputs/literals.yue +++ b/spec/inputs/literals.yue | |||
| @@ -10,6 +10,9 @@ _ = { | |||
| 10 | 0xfF2323 | 10 | 0xfF2323 |
| 11 | 0xabcdef | 11 | 0xabcdef |
| 12 | 0xABCDEF | 12 | 0xABCDEF |
| 13 | 0x123p-123 | ||
| 14 | 0xABCP+321 | ||
| 15 | 0x.1p-111 | ||
| 13 | 16 | ||
| 14 | .2323 | 17 | .2323 |
| 15 | .2323e-1 | 18 | .2323e-1 |
diff --git a/spec/outputs/literals.lua b/spec/outputs/literals.lua index 4495725..0d4d8b8 100644 --- a/spec/outputs/literals.lua +++ b/spec/outputs/literals.lua | |||
| @@ -8,6 +8,9 @@ local _ = { | |||
| 8 | 0xfF2323, | 8 | 0xfF2323, |
| 9 | 0xabcdef, | 9 | 0xabcdef, |
| 10 | 0xABCDEF, | 10 | 0xABCDEF, |
| 11 | 0x123p-123, | ||
| 12 | 0xABCP+321, | ||
| 13 | 0x.1p-111, | ||
| 11 | .2323, | 14 | .2323, |
| 12 | .2323e-1, | 15 | .2323e-1, |
| 13 | .2323e13434, | 16 | .2323e13434, |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 3e58305..0d674f8 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
| @@ -60,7 +60,7 @@ namespace yue { | |||
| 60 | 60 | ||
| 61 | typedef std::list<std::string> str_list; | 61 | typedef std::list<std::string> str_list; |
| 62 | 62 | ||
| 63 | const std::string_view version = "0.15.17"sv; | 63 | const std::string_view version = "0.15.18"sv; |
| 64 | const std::string_view extension = "yue"sv; | 64 | const std::string_view extension = "yue"sv; |
| 65 | 65 | ||
| 66 | class YueCompilerImpl { | 66 | class YueCompilerImpl { |
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index 63c9162..acdc343 100644 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
| @@ -57,23 +57,25 @@ YueParser::YueParser() { | |||
| 57 | num_char_hex = range('0', '9') | range('a', 'f') | range('A', 'F'); | 57 | num_char_hex = range('0', '9') | range('a', 'f') | range('A', 'F'); |
| 58 | num_lit = num_char_hex >> *(num_char_hex | expr('_') >> and_(num_char_hex)); | 58 | num_lit = num_char_hex >> *(num_char_hex | expr('_') >> and_(num_char_hex)); |
| 59 | Num = ( | 59 | Num = ( |
| 60 | "0x." >> +num_lit >> -num_expo_hex | 60 | "0x" >> ( |
| 61 | ) | ( | 61 | +num_lit >> ( |
| 62 | "0x" >> +num_lit >> ( | 62 | '.' >> +num_lit >> -num_expo_hex | |
| 63 | '.' >> +num_lit >> -num_expo_hex | | 63 | num_expo_hex | |
| 64 | num_expo_hex | | 64 | lj_num | |
| 65 | lj_num | | 65 | true_() |
| 66 | true_() | 66 | ) | ( |
| 67 | '.' >> +num_lit >> -num_expo_hex | ||
| 68 | ) | ||
| 67 | ) | 69 | ) |
| 68 | ) | ( | 70 | ) | ( |
| 69 | '.' >> +num_char >> -num_expo | ||
| 70 | ) | ( | ||
| 71 | +num_char >> ( | 71 | +num_char >> ( |
| 72 | '.' >> +num_char >> -num_expo | | 72 | '.' >> +num_char >> -num_expo | |
| 73 | num_expo | | 73 | num_expo | |
| 74 | lj_num | | 74 | lj_num | |
| 75 | true_() | 75 | true_() |
| 76 | ) | 76 | ) |
| 77 | ) | ( | ||
| 78 | '.' >> +num_char >> -num_expo | ||
| 77 | ); | 79 | ); |
| 78 | 80 | ||
| 79 | Cut = false_(); | 81 | Cut = false_(); |
