From ff77831b042ad6fa47d170be147f8b9ad57ad45c Mon Sep 17 00:00:00 2001 From: Xestiny_ Date: Sun, 7 Apr 2024 14:18:07 +0900 Subject: [PATCH] Added Float data type with suffix 'f'. --- ftb_snbt_lib/__init__.py | 2 +- ftb_snbt_lib/parse.py | 1 + ftb_snbt_lib/parser.out | 683 +++++++++++++++++++++------------------ ftb_snbt_lib/parsetab.py | 29 +- ftb_snbt_lib/tag.py | 6 +- ftb_snbt_lib/token.py | 6 + 6 files changed, 397 insertions(+), 330 deletions(-) diff --git a/ftb_snbt_lib/__init__.py b/ftb_snbt_lib/__init__.py index 8b6ccba..d292b94 100644 --- a/ftb_snbt_lib/__init__.py +++ b/ftb_snbt_lib/__init__.py @@ -2,5 +2,5 @@ from .tag import * from .write import * -__version__ = '0.2.1' +__version__ = '0.2.2' __all__ = ['parse', 'tag', 'write'] \ No newline at end of file diff --git a/ftb_snbt_lib/parse.py b/ftb_snbt_lib/parse.py index eebb14f..4df7fd8 100644 --- a/ftb_snbt_lib/parse.py +++ b/ftb_snbt_lib/parse.py @@ -39,6 +39,7 @@ def p_value(p): | BOOL | BYTE | SHORT + | FLOAT | DOUBLE | LONG | INTEGER diff --git a/ftb_snbt_lib/parser.out b/ftb_snbt_lib/parser.out index 00d4ab8..0f30200 100644 --- a/ftb_snbt_lib/parser.out +++ b/ftb_snbt_lib/parser.out @@ -17,35 +17,37 @@ Rule 11 value -> array Rule 12 value -> BOOL Rule 13 value -> BYTE Rule 14 value -> SHORT -Rule 15 value -> DOUBLE -Rule 16 value -> LONG -Rule 17 value -> INTEGER -Rule 18 value -> STRING -Rule 19 list -> LBRACKET values RBRACKET -Rule 20 list -> LBRACKET RBRACKET -Rule 21 array -> LBRACKET NAME SEMICOLON values RBRACKET -Rule 22 array -> LBRACKET NAME SEMICOLON RBRACKET -Rule 23 values -> values value -Rule 24 values -> values COMMA value -Rule 25 values -> value +Rule 15 value -> FLOAT +Rule 16 value -> DOUBLE +Rule 17 value -> LONG +Rule 18 value -> INTEGER +Rule 19 value -> STRING +Rule 20 list -> LBRACKET values RBRACKET +Rule 21 list -> LBRACKET RBRACKET +Rule 22 array -> LBRACKET NAME SEMICOLON values RBRACKET +Rule 23 array -> LBRACKET NAME SEMICOLON RBRACKET +Rule 24 values -> values value +Rule 25 values -> values COMMA value +Rule 26 values -> value Terminals, with rules where they appear BOOL : 12 BYTE : 13 COLON : 7 8 -COMMA : 5 24 -DOUBLE : 15 -INTEGER : 17 +COMMA : 5 25 +DOUBLE : 16 +FLOAT : 15 +INTEGER : 18 LBRACE : 2 3 -LBRACKET : 19 20 21 22 -LONG : 16 -NAME : 7 21 22 +LBRACKET : 20 21 22 23 +LONG : 17 +NAME : 7 22 23 RBRACE : 2 3 -RBRACKET : 19 20 21 22 -SEMICOLON : 21 22 +RBRACKET : 20 21 22 23 +SEMICOLON : 22 23 SHORT : 14 -STRING : 8 18 +STRING : 8 19 error : Nonterminals, with rules where they appear @@ -56,8 +58,8 @@ key_value_pair : 4 5 6 key_value_pairs : 2 4 5 list : 10 snbt : 0 -value : 7 8 23 24 25 -values : 19 21 23 24 +value : 7 8 24 25 26 +values : 20 22 24 25 Parsing method: LALR @@ -131,6 +133,7 @@ state 5 BOOL reduce using rule 3 (compound -> LBRACE RBRACE .) BYTE reduce using rule 3 (compound -> LBRACE RBRACE .) SHORT reduce using rule 3 (compound -> LBRACE RBRACE .) + FLOAT reduce using rule 3 (compound -> LBRACE RBRACE .) DOUBLE reduce using rule 3 (compound -> LBRACE RBRACE .) LONG reduce using rule 3 (compound -> LBRACE RBRACE .) INTEGER reduce using rule 3 (compound -> LBRACE RBRACE .) @@ -175,6 +178,7 @@ state 9 BOOL reduce using rule 2 (compound -> LBRACE key_value_pairs RBRACE .) BYTE reduce using rule 2 (compound -> LBRACE key_value_pairs RBRACE .) SHORT reduce using rule 2 (compound -> LBRACE key_value_pairs RBRACE .) + FLOAT reduce using rule 2 (compound -> LBRACE key_value_pairs RBRACE .) DOUBLE reduce using rule 2 (compound -> LBRACE key_value_pairs RBRACE .) LONG reduce using rule 2 (compound -> LBRACE key_value_pairs RBRACE .) INTEGER reduce using rule 2 (compound -> LBRACE key_value_pairs RBRACE .) @@ -212,26 +216,28 @@ state 12 (12) value -> . BOOL (13) value -> . BYTE (14) value -> . SHORT - (15) value -> . DOUBLE - (16) value -> . LONG - (17) value -> . INTEGER - (18) value -> . STRING + (15) value -> . FLOAT + (16) value -> . DOUBLE + (17) value -> . LONG + (18) value -> . INTEGER + (19) value -> . STRING (2) compound -> . LBRACE key_value_pairs RBRACE (3) compound -> . LBRACE RBRACE - (19) list -> . LBRACKET values RBRACKET - (20) list -> . LBRACKET RBRACKET - (21) array -> . LBRACKET NAME SEMICOLON values RBRACKET - (22) array -> . LBRACKET NAME SEMICOLON RBRACKET + (20) list -> . LBRACKET values RBRACKET + (21) list -> . LBRACKET RBRACKET + (22) array -> . LBRACKET NAME SEMICOLON values RBRACKET + (23) array -> . LBRACKET NAME SEMICOLON RBRACKET BOOL shift and go to state 19 BYTE shift and go to state 20 SHORT shift and go to state 21 - DOUBLE shift and go to state 22 - LONG shift and go to state 23 - INTEGER shift and go to state 24 - STRING shift and go to state 25 + FLOAT shift and go to state 22 + DOUBLE shift and go to state 23 + LONG shift and go to state 24 + INTEGER shift and go to state 25 + STRING shift and go to state 26 LBRACE shift and go to state 3 - LBRACKET shift and go to state 26 + LBRACKET shift and go to state 27 value shift and go to state 15 compound shift and go to state 16 @@ -247,28 +253,30 @@ state 13 (12) value -> . BOOL (13) value -> . BYTE (14) value -> . SHORT - (15) value -> . DOUBLE - (16) value -> . LONG - (17) value -> . INTEGER - (18) value -> . STRING + (15) value -> . FLOAT + (16) value -> . DOUBLE + (17) value -> . LONG + (18) value -> . INTEGER + (19) value -> . STRING (2) compound -> . LBRACE key_value_pairs RBRACE (3) compound -> . LBRACE RBRACE - (19) list -> . LBRACKET values RBRACKET - (20) list -> . LBRACKET RBRACKET - (21) array -> . LBRACKET NAME SEMICOLON values RBRACKET - (22) array -> . LBRACKET NAME SEMICOLON RBRACKET + (20) list -> . LBRACKET values RBRACKET + (21) list -> . LBRACKET RBRACKET + (22) array -> . LBRACKET NAME SEMICOLON values RBRACKET + (23) array -> . LBRACKET NAME SEMICOLON RBRACKET BOOL shift and go to state 19 BYTE shift and go to state 20 SHORT shift and go to state 21 - DOUBLE shift and go to state 22 - LONG shift and go to state 23 - INTEGER shift and go to state 24 - STRING shift and go to state 25 + FLOAT shift and go to state 22 + DOUBLE shift and go to state 23 + LONG shift and go to state 24 + INTEGER shift and go to state 25 + STRING shift and go to state 26 LBRACE shift and go to state 3 - LBRACKET shift and go to state 26 + LBRACKET shift and go to state 27 - value shift and go to state 27 + value shift and go to state 28 compound shift and go to state 16 list shift and go to state 17 array shift and go to state 18 @@ -305,6 +313,7 @@ state 16 BOOL reduce using rule 9 (value -> compound .) BYTE reduce using rule 9 (value -> compound .) SHORT reduce using rule 9 (value -> compound .) + FLOAT reduce using rule 9 (value -> compound .) DOUBLE reduce using rule 9 (value -> compound .) LONG reduce using rule 9 (value -> compound .) INTEGER reduce using rule 9 (value -> compound .) @@ -324,6 +333,7 @@ state 17 BOOL reduce using rule 10 (value -> list .) BYTE reduce using rule 10 (value -> list .) SHORT reduce using rule 10 (value -> list .) + FLOAT reduce using rule 10 (value -> list .) DOUBLE reduce using rule 10 (value -> list .) LONG reduce using rule 10 (value -> list .) INTEGER reduce using rule 10 (value -> list .) @@ -343,6 +353,7 @@ state 18 BOOL reduce using rule 11 (value -> array .) BYTE reduce using rule 11 (value -> array .) SHORT reduce using rule 11 (value -> array .) + FLOAT reduce using rule 11 (value -> array .) DOUBLE reduce using rule 11 (value -> array .) LONG reduce using rule 11 (value -> array .) INTEGER reduce using rule 11 (value -> array .) @@ -362,6 +373,7 @@ state 19 BOOL reduce using rule 12 (value -> BOOL .) BYTE reduce using rule 12 (value -> BOOL .) SHORT reduce using rule 12 (value -> BOOL .) + FLOAT reduce using rule 12 (value -> BOOL .) DOUBLE reduce using rule 12 (value -> BOOL .) LONG reduce using rule 12 (value -> BOOL .) INTEGER reduce using rule 12 (value -> BOOL .) @@ -381,6 +393,7 @@ state 20 BOOL reduce using rule 13 (value -> BYTE .) BYTE reduce using rule 13 (value -> BYTE .) SHORT reduce using rule 13 (value -> BYTE .) + FLOAT reduce using rule 13 (value -> BYTE .) DOUBLE reduce using rule 13 (value -> BYTE .) LONG reduce using rule 13 (value -> BYTE .) INTEGER reduce using rule 13 (value -> BYTE .) @@ -400,6 +413,7 @@ state 21 BOOL reduce using rule 14 (value -> SHORT .) BYTE reduce using rule 14 (value -> SHORT .) SHORT reduce using rule 14 (value -> SHORT .) + FLOAT reduce using rule 14 (value -> SHORT .) DOUBLE reduce using rule 14 (value -> SHORT .) LONG reduce using rule 14 (value -> SHORT .) INTEGER reduce using rule 14 (value -> SHORT .) @@ -409,125 +423,151 @@ state 21 state 22 - (15) value -> DOUBLE . + (15) value -> FLOAT . - RBRACE reduce using rule 15 (value -> DOUBLE .) - COMMA reduce using rule 15 (value -> DOUBLE .) - NAME reduce using rule 15 (value -> DOUBLE .) - STRING reduce using rule 15 (value -> DOUBLE .) - RBRACKET reduce using rule 15 (value -> DOUBLE .) - BOOL reduce using rule 15 (value -> DOUBLE .) - BYTE reduce using rule 15 (value -> DOUBLE .) - SHORT reduce using rule 15 (value -> DOUBLE .) - DOUBLE reduce using rule 15 (value -> DOUBLE .) - LONG reduce using rule 15 (value -> DOUBLE .) - INTEGER reduce using rule 15 (value -> DOUBLE .) - LBRACE reduce using rule 15 (value -> DOUBLE .) - LBRACKET reduce using rule 15 (value -> DOUBLE .) + RBRACE reduce using rule 15 (value -> FLOAT .) + COMMA reduce using rule 15 (value -> FLOAT .) + NAME reduce using rule 15 (value -> FLOAT .) + STRING reduce using rule 15 (value -> FLOAT .) + RBRACKET reduce using rule 15 (value -> FLOAT .) + BOOL reduce using rule 15 (value -> FLOAT .) + BYTE reduce using rule 15 (value -> FLOAT .) + SHORT reduce using rule 15 (value -> FLOAT .) + FLOAT reduce using rule 15 (value -> FLOAT .) + DOUBLE reduce using rule 15 (value -> FLOAT .) + LONG reduce using rule 15 (value -> FLOAT .) + INTEGER reduce using rule 15 (value -> FLOAT .) + LBRACE reduce using rule 15 (value -> FLOAT .) + LBRACKET reduce using rule 15 (value -> FLOAT .) state 23 - (16) value -> LONG . + (16) value -> DOUBLE . - RBRACE reduce using rule 16 (value -> LONG .) - COMMA reduce using rule 16 (value -> LONG .) - NAME reduce using rule 16 (value -> LONG .) - STRING reduce using rule 16 (value -> LONG .) - RBRACKET reduce using rule 16 (value -> LONG .) - BOOL reduce using rule 16 (value -> LONG .) - BYTE reduce using rule 16 (value -> LONG .) - SHORT reduce using rule 16 (value -> LONG .) - DOUBLE reduce using rule 16 (value -> LONG .) - LONG reduce using rule 16 (value -> LONG .) - INTEGER reduce using rule 16 (value -> LONG .) - LBRACE reduce using rule 16 (value -> LONG .) - LBRACKET reduce using rule 16 (value -> LONG .) + RBRACE reduce using rule 16 (value -> DOUBLE .) + COMMA reduce using rule 16 (value -> DOUBLE .) + NAME reduce using rule 16 (value -> DOUBLE .) + STRING reduce using rule 16 (value -> DOUBLE .) + RBRACKET reduce using rule 16 (value -> DOUBLE .) + BOOL reduce using rule 16 (value -> DOUBLE .) + BYTE reduce using rule 16 (value -> DOUBLE .) + SHORT reduce using rule 16 (value -> DOUBLE .) + FLOAT reduce using rule 16 (value -> DOUBLE .) + DOUBLE reduce using rule 16 (value -> DOUBLE .) + LONG reduce using rule 16 (value -> DOUBLE .) + INTEGER reduce using rule 16 (value -> DOUBLE .) + LBRACE reduce using rule 16 (value -> DOUBLE .) + LBRACKET reduce using rule 16 (value -> DOUBLE .) state 24 - (17) value -> INTEGER . + (17) value -> LONG . - RBRACE reduce using rule 17 (value -> INTEGER .) - COMMA reduce using rule 17 (value -> INTEGER .) - NAME reduce using rule 17 (value -> INTEGER .) - STRING reduce using rule 17 (value -> INTEGER .) - RBRACKET reduce using rule 17 (value -> INTEGER .) - BOOL reduce using rule 17 (value -> INTEGER .) - BYTE reduce using rule 17 (value -> INTEGER .) - SHORT reduce using rule 17 (value -> INTEGER .) - DOUBLE reduce using rule 17 (value -> INTEGER .) - LONG reduce using rule 17 (value -> INTEGER .) - INTEGER reduce using rule 17 (value -> INTEGER .) - LBRACE reduce using rule 17 (value -> INTEGER .) - LBRACKET reduce using rule 17 (value -> INTEGER .) + RBRACE reduce using rule 17 (value -> LONG .) + COMMA reduce using rule 17 (value -> LONG .) + NAME reduce using rule 17 (value -> LONG .) + STRING reduce using rule 17 (value -> LONG .) + RBRACKET reduce using rule 17 (value -> LONG .) + BOOL reduce using rule 17 (value -> LONG .) + BYTE reduce using rule 17 (value -> LONG .) + SHORT reduce using rule 17 (value -> LONG .) + FLOAT reduce using rule 17 (value -> LONG .) + DOUBLE reduce using rule 17 (value -> LONG .) + LONG reduce using rule 17 (value -> LONG .) + INTEGER reduce using rule 17 (value -> LONG .) + LBRACE reduce using rule 17 (value -> LONG .) + LBRACKET reduce using rule 17 (value -> LONG .) state 25 - (18) value -> STRING . + (18) value -> INTEGER . - RBRACE reduce using rule 18 (value -> STRING .) - COMMA reduce using rule 18 (value -> STRING .) - NAME reduce using rule 18 (value -> STRING .) - STRING reduce using rule 18 (value -> STRING .) - RBRACKET reduce using rule 18 (value -> STRING .) - BOOL reduce using rule 18 (value -> STRING .) - BYTE reduce using rule 18 (value -> STRING .) - SHORT reduce using rule 18 (value -> STRING .) - DOUBLE reduce using rule 18 (value -> STRING .) - LONG reduce using rule 18 (value -> STRING .) - INTEGER reduce using rule 18 (value -> STRING .) - LBRACE reduce using rule 18 (value -> STRING .) - LBRACKET reduce using rule 18 (value -> STRING .) + RBRACE reduce using rule 18 (value -> INTEGER .) + COMMA reduce using rule 18 (value -> INTEGER .) + NAME reduce using rule 18 (value -> INTEGER .) + STRING reduce using rule 18 (value -> INTEGER .) + RBRACKET reduce using rule 18 (value -> INTEGER .) + BOOL reduce using rule 18 (value -> INTEGER .) + BYTE reduce using rule 18 (value -> INTEGER .) + SHORT reduce using rule 18 (value -> INTEGER .) + FLOAT reduce using rule 18 (value -> INTEGER .) + DOUBLE reduce using rule 18 (value -> INTEGER .) + LONG reduce using rule 18 (value -> INTEGER .) + INTEGER reduce using rule 18 (value -> INTEGER .) + LBRACE reduce using rule 18 (value -> INTEGER .) + LBRACKET reduce using rule 18 (value -> INTEGER .) state 26 - (19) list -> LBRACKET . values RBRACKET - (20) list -> LBRACKET . RBRACKET - (21) array -> LBRACKET . NAME SEMICOLON values RBRACKET - (22) array -> LBRACKET . NAME SEMICOLON RBRACKET - (23) values -> . values value - (24) values -> . values COMMA value - (25) values -> . value + (19) value -> STRING . + + RBRACE reduce using rule 19 (value -> STRING .) + COMMA reduce using rule 19 (value -> STRING .) + NAME reduce using rule 19 (value -> STRING .) + STRING reduce using rule 19 (value -> STRING .) + RBRACKET reduce using rule 19 (value -> STRING .) + BOOL reduce using rule 19 (value -> STRING .) + BYTE reduce using rule 19 (value -> STRING .) + SHORT reduce using rule 19 (value -> STRING .) + FLOAT reduce using rule 19 (value -> STRING .) + DOUBLE reduce using rule 19 (value -> STRING .) + LONG reduce using rule 19 (value -> STRING .) + INTEGER reduce using rule 19 (value -> STRING .) + LBRACE reduce using rule 19 (value -> STRING .) + LBRACKET reduce using rule 19 (value -> STRING .) + + +state 27 + + (20) list -> LBRACKET . values RBRACKET + (21) list -> LBRACKET . RBRACKET + (22) array -> LBRACKET . NAME SEMICOLON values RBRACKET + (23) array -> LBRACKET . NAME SEMICOLON RBRACKET + (24) values -> . values value + (25) values -> . values COMMA value + (26) values -> . value (9) value -> . compound (10) value -> . list (11) value -> . array (12) value -> . BOOL (13) value -> . BYTE (14) value -> . SHORT - (15) value -> . DOUBLE - (16) value -> . LONG - (17) value -> . INTEGER - (18) value -> . STRING + (15) value -> . FLOAT + (16) value -> . DOUBLE + (17) value -> . LONG + (18) value -> . INTEGER + (19) value -> . STRING (2) compound -> . LBRACE key_value_pairs RBRACE (3) compound -> . LBRACE RBRACE - (19) list -> . LBRACKET values RBRACKET - (20) list -> . LBRACKET RBRACKET - (21) array -> . LBRACKET NAME SEMICOLON values RBRACKET - (22) array -> . LBRACKET NAME SEMICOLON RBRACKET + (20) list -> . LBRACKET values RBRACKET + (21) list -> . LBRACKET RBRACKET + (22) array -> . LBRACKET NAME SEMICOLON values RBRACKET + (23) array -> . LBRACKET NAME SEMICOLON RBRACKET - RBRACKET shift and go to state 29 - NAME shift and go to state 30 + RBRACKET shift and go to state 30 + NAME shift and go to state 31 BOOL shift and go to state 19 BYTE shift and go to state 20 SHORT shift and go to state 21 - DOUBLE shift and go to state 22 - LONG shift and go to state 23 - INTEGER shift and go to state 24 - STRING shift and go to state 25 + FLOAT shift and go to state 22 + DOUBLE shift and go to state 23 + LONG shift and go to state 24 + INTEGER shift and go to state 25 + STRING shift and go to state 26 LBRACE shift and go to state 3 - LBRACKET shift and go to state 26 + LBRACKET shift and go to state 27 - values shift and go to state 28 - value shift and go to state 31 + values shift and go to state 29 + value shift and go to state 32 compound shift and go to state 16 list shift and go to state 17 array shift and go to state 18 -state 27 +state 28 (8) key_value_pair -> STRING COLON value . @@ -537,291 +577,306 @@ state 27 STRING reduce using rule 8 (key_value_pair -> STRING COLON value .) -state 28 +state 29 - (19) list -> LBRACKET values . RBRACKET - (23) values -> values . value - (24) values -> values . COMMA value + (20) list -> LBRACKET values . RBRACKET + (24) values -> values . value + (25) values -> values . COMMA value (9) value -> . compound (10) value -> . list (11) value -> . array (12) value -> . BOOL (13) value -> . BYTE (14) value -> . SHORT - (15) value -> . DOUBLE - (16) value -> . LONG - (17) value -> . INTEGER - (18) value -> . STRING + (15) value -> . FLOAT + (16) value -> . DOUBLE + (17) value -> . LONG + (18) value -> . INTEGER + (19) value -> . STRING (2) compound -> . LBRACE key_value_pairs RBRACE (3) compound -> . LBRACE RBRACE - (19) list -> . LBRACKET values RBRACKET - (20) list -> . LBRACKET RBRACKET - (21) array -> . LBRACKET NAME SEMICOLON values RBRACKET - (22) array -> . LBRACKET NAME SEMICOLON RBRACKET + (20) list -> . LBRACKET values RBRACKET + (21) list -> . LBRACKET RBRACKET + (22) array -> . LBRACKET NAME SEMICOLON values RBRACKET + (23) array -> . LBRACKET NAME SEMICOLON RBRACKET - RBRACKET shift and go to state 32 - COMMA shift and go to state 34 + RBRACKET shift and go to state 33 + COMMA shift and go to state 35 BOOL shift and go to state 19 BYTE shift and go to state 20 SHORT shift and go to state 21 - DOUBLE shift and go to state 22 - LONG shift and go to state 23 - INTEGER shift and go to state 24 - STRING shift and go to state 25 + FLOAT shift and go to state 22 + DOUBLE shift and go to state 23 + LONG shift and go to state 24 + INTEGER shift and go to state 25 + STRING shift and go to state 26 LBRACE shift and go to state 3 - LBRACKET shift and go to state 26 + LBRACKET shift and go to state 27 - value shift and go to state 33 + value shift and go to state 34 compound shift and go to state 16 list shift and go to state 17 array shift and go to state 18 -state 29 - - (20) list -> LBRACKET RBRACKET . - - RBRACE reduce using rule 20 (list -> LBRACKET RBRACKET .) - COMMA reduce using rule 20 (list -> LBRACKET RBRACKET .) - NAME reduce using rule 20 (list -> LBRACKET RBRACKET .) - STRING reduce using rule 20 (list -> LBRACKET RBRACKET .) - RBRACKET reduce using rule 20 (list -> LBRACKET RBRACKET .) - BOOL reduce using rule 20 (list -> LBRACKET RBRACKET .) - BYTE reduce using rule 20 (list -> LBRACKET RBRACKET .) - SHORT reduce using rule 20 (list -> LBRACKET RBRACKET .) - DOUBLE reduce using rule 20 (list -> LBRACKET RBRACKET .) - LONG reduce using rule 20 (list -> LBRACKET RBRACKET .) - INTEGER reduce using rule 20 (list -> LBRACKET RBRACKET .) - LBRACE reduce using rule 20 (list -> LBRACKET RBRACKET .) - LBRACKET reduce using rule 20 (list -> LBRACKET RBRACKET .) - - state 30 - (21) array -> LBRACKET NAME . SEMICOLON values RBRACKET - (22) array -> LBRACKET NAME . SEMICOLON RBRACKET + (21) list -> LBRACKET RBRACKET . - SEMICOLON shift and go to state 35 + RBRACE reduce using rule 21 (list -> LBRACKET RBRACKET .) + COMMA reduce using rule 21 (list -> LBRACKET RBRACKET .) + NAME reduce using rule 21 (list -> LBRACKET RBRACKET .) + STRING reduce using rule 21 (list -> LBRACKET RBRACKET .) + RBRACKET reduce using rule 21 (list -> LBRACKET RBRACKET .) + BOOL reduce using rule 21 (list -> LBRACKET RBRACKET .) + BYTE reduce using rule 21 (list -> LBRACKET RBRACKET .) + SHORT reduce using rule 21 (list -> LBRACKET RBRACKET .) + FLOAT reduce using rule 21 (list -> LBRACKET RBRACKET .) + DOUBLE reduce using rule 21 (list -> LBRACKET RBRACKET .) + LONG reduce using rule 21 (list -> LBRACKET RBRACKET .) + INTEGER reduce using rule 21 (list -> LBRACKET RBRACKET .) + LBRACE reduce using rule 21 (list -> LBRACKET RBRACKET .) + LBRACKET reduce using rule 21 (list -> LBRACKET RBRACKET .) state 31 - (25) values -> value . + (22) array -> LBRACKET NAME . SEMICOLON values RBRACKET + (23) array -> LBRACKET NAME . SEMICOLON RBRACKET - RBRACKET reduce using rule 25 (values -> value .) - COMMA reduce using rule 25 (values -> value .) - BOOL reduce using rule 25 (values -> value .) - BYTE reduce using rule 25 (values -> value .) - SHORT reduce using rule 25 (values -> value .) - DOUBLE reduce using rule 25 (values -> value .) - LONG reduce using rule 25 (values -> value .) - INTEGER reduce using rule 25 (values -> value .) - STRING reduce using rule 25 (values -> value .) - LBRACE reduce using rule 25 (values -> value .) - LBRACKET reduce using rule 25 (values -> value .) + SEMICOLON shift and go to state 36 state 32 - (19) list -> LBRACKET values RBRACKET . + (26) values -> value . - RBRACE reduce using rule 19 (list -> LBRACKET values RBRACKET .) - COMMA reduce using rule 19 (list -> LBRACKET values RBRACKET .) - NAME reduce using rule 19 (list -> LBRACKET values RBRACKET .) - STRING reduce using rule 19 (list -> LBRACKET values RBRACKET .) - RBRACKET reduce using rule 19 (list -> LBRACKET values RBRACKET .) - BOOL reduce using rule 19 (list -> LBRACKET values RBRACKET .) - BYTE reduce using rule 19 (list -> LBRACKET values RBRACKET .) - SHORT reduce using rule 19 (list -> LBRACKET values RBRACKET .) - DOUBLE reduce using rule 19 (list -> LBRACKET values RBRACKET .) - LONG reduce using rule 19 (list -> LBRACKET values RBRACKET .) - INTEGER reduce using rule 19 (list -> LBRACKET values RBRACKET .) - LBRACE reduce using rule 19 (list -> LBRACKET values RBRACKET .) - LBRACKET reduce using rule 19 (list -> LBRACKET values RBRACKET .) + RBRACKET reduce using rule 26 (values -> value .) + COMMA reduce using rule 26 (values -> value .) + BOOL reduce using rule 26 (values -> value .) + BYTE reduce using rule 26 (values -> value .) + SHORT reduce using rule 26 (values -> value .) + FLOAT reduce using rule 26 (values -> value .) + DOUBLE reduce using rule 26 (values -> value .) + LONG reduce using rule 26 (values -> value .) + INTEGER reduce using rule 26 (values -> value .) + STRING reduce using rule 26 (values -> value .) + LBRACE reduce using rule 26 (values -> value .) + LBRACKET reduce using rule 26 (values -> value .) state 33 - (23) values -> values value . + (20) list -> LBRACKET values RBRACKET . - RBRACKET reduce using rule 23 (values -> values value .) - COMMA reduce using rule 23 (values -> values value .) - BOOL reduce using rule 23 (values -> values value .) - BYTE reduce using rule 23 (values -> values value .) - SHORT reduce using rule 23 (values -> values value .) - DOUBLE reduce using rule 23 (values -> values value .) - LONG reduce using rule 23 (values -> values value .) - INTEGER reduce using rule 23 (values -> values value .) - STRING reduce using rule 23 (values -> values value .) - LBRACE reduce using rule 23 (values -> values value .) - LBRACKET reduce using rule 23 (values -> values value .) + RBRACE reduce using rule 20 (list -> LBRACKET values RBRACKET .) + COMMA reduce using rule 20 (list -> LBRACKET values RBRACKET .) + NAME reduce using rule 20 (list -> LBRACKET values RBRACKET .) + STRING reduce using rule 20 (list -> LBRACKET values RBRACKET .) + RBRACKET reduce using rule 20 (list -> LBRACKET values RBRACKET .) + BOOL reduce using rule 20 (list -> LBRACKET values RBRACKET .) + BYTE reduce using rule 20 (list -> LBRACKET values RBRACKET .) + SHORT reduce using rule 20 (list -> LBRACKET values RBRACKET .) + FLOAT reduce using rule 20 (list -> LBRACKET values RBRACKET .) + DOUBLE reduce using rule 20 (list -> LBRACKET values RBRACKET .) + LONG reduce using rule 20 (list -> LBRACKET values RBRACKET .) + INTEGER reduce using rule 20 (list -> LBRACKET values RBRACKET .) + LBRACE reduce using rule 20 (list -> LBRACKET values RBRACKET .) + LBRACKET reduce using rule 20 (list -> LBRACKET values RBRACKET .) state 34 - (24) values -> values COMMA . value + (24) values -> values value . + + RBRACKET reduce using rule 24 (values -> values value .) + COMMA reduce using rule 24 (values -> values value .) + BOOL reduce using rule 24 (values -> values value .) + BYTE reduce using rule 24 (values -> values value .) + SHORT reduce using rule 24 (values -> values value .) + FLOAT reduce using rule 24 (values -> values value .) + DOUBLE reduce using rule 24 (values -> values value .) + LONG reduce using rule 24 (values -> values value .) + INTEGER reduce using rule 24 (values -> values value .) + STRING reduce using rule 24 (values -> values value .) + LBRACE reduce using rule 24 (values -> values value .) + LBRACKET reduce using rule 24 (values -> values value .) + + +state 35 + + (25) values -> values COMMA . value (9) value -> . compound (10) value -> . list (11) value -> . array (12) value -> . BOOL (13) value -> . BYTE (14) value -> . SHORT - (15) value -> . DOUBLE - (16) value -> . LONG - (17) value -> . INTEGER - (18) value -> . STRING + (15) value -> . FLOAT + (16) value -> . DOUBLE + (17) value -> . LONG + (18) value -> . INTEGER + (19) value -> . STRING (2) compound -> . LBRACE key_value_pairs RBRACE (3) compound -> . LBRACE RBRACE - (19) list -> . LBRACKET values RBRACKET - (20) list -> . LBRACKET RBRACKET - (21) array -> . LBRACKET NAME SEMICOLON values RBRACKET - (22) array -> . LBRACKET NAME SEMICOLON RBRACKET + (20) list -> . LBRACKET values RBRACKET + (21) list -> . LBRACKET RBRACKET + (22) array -> . LBRACKET NAME SEMICOLON values RBRACKET + (23) array -> . LBRACKET NAME SEMICOLON RBRACKET BOOL shift and go to state 19 BYTE shift and go to state 20 SHORT shift and go to state 21 - DOUBLE shift and go to state 22 - LONG shift and go to state 23 - INTEGER shift and go to state 24 - STRING shift and go to state 25 + FLOAT shift and go to state 22 + DOUBLE shift and go to state 23 + LONG shift and go to state 24 + INTEGER shift and go to state 25 + STRING shift and go to state 26 LBRACE shift and go to state 3 - LBRACKET shift and go to state 26 + LBRACKET shift and go to state 27 - value shift and go to state 36 + value shift and go to state 37 compound shift and go to state 16 list shift and go to state 17 array shift and go to state 18 -state 35 +state 36 - (21) array -> LBRACKET NAME SEMICOLON . values RBRACKET - (22) array -> LBRACKET NAME SEMICOLON . RBRACKET - (23) values -> . values value - (24) values -> . values COMMA value - (25) values -> . value + (22) array -> LBRACKET NAME SEMICOLON . values RBRACKET + (23) array -> LBRACKET NAME SEMICOLON . RBRACKET + (24) values -> . values value + (25) values -> . values COMMA value + (26) values -> . value (9) value -> . compound (10) value -> . list (11) value -> . array (12) value -> . BOOL (13) value -> . BYTE (14) value -> . SHORT - (15) value -> . DOUBLE - (16) value -> . LONG - (17) value -> . INTEGER - (18) value -> . STRING + (15) value -> . FLOAT + (16) value -> . DOUBLE + (17) value -> . LONG + (18) value -> . INTEGER + (19) value -> . STRING (2) compound -> . LBRACE key_value_pairs RBRACE (3) compound -> . LBRACE RBRACE - (19) list -> . LBRACKET values RBRACKET - (20) list -> . LBRACKET RBRACKET - (21) array -> . LBRACKET NAME SEMICOLON values RBRACKET - (22) array -> . LBRACKET NAME SEMICOLON RBRACKET + (20) list -> . LBRACKET values RBRACKET + (21) list -> . LBRACKET RBRACKET + (22) array -> . LBRACKET NAME SEMICOLON values RBRACKET + (23) array -> . LBRACKET NAME SEMICOLON RBRACKET - RBRACKET shift and go to state 38 + RBRACKET shift and go to state 39 BOOL shift and go to state 19 BYTE shift and go to state 20 SHORT shift and go to state 21 - DOUBLE shift and go to state 22 - LONG shift and go to state 23 - INTEGER shift and go to state 24 - STRING shift and go to state 25 + FLOAT shift and go to state 22 + DOUBLE shift and go to state 23 + LONG shift and go to state 24 + INTEGER shift and go to state 25 + STRING shift and go to state 26 LBRACE shift and go to state 3 - LBRACKET shift and go to state 26 + LBRACKET shift and go to state 27 - values shift and go to state 37 - value shift and go to state 31 + values shift and go to state 38 + value shift and go to state 32 compound shift and go to state 16 list shift and go to state 17 array shift and go to state 18 -state 36 +state 37 - (24) values -> values COMMA value . + (25) values -> values COMMA value . - RBRACKET reduce using rule 24 (values -> values COMMA value .) - COMMA reduce using rule 24 (values -> values COMMA value .) - BOOL reduce using rule 24 (values -> values COMMA value .) - BYTE reduce using rule 24 (values -> values COMMA value .) - SHORT reduce using rule 24 (values -> values COMMA value .) - DOUBLE reduce using rule 24 (values -> values COMMA value .) - LONG reduce using rule 24 (values -> values COMMA value .) - INTEGER reduce using rule 24 (values -> values COMMA value .) - STRING reduce using rule 24 (values -> values COMMA value .) - LBRACE reduce using rule 24 (values -> values COMMA value .) - LBRACKET reduce using rule 24 (values -> values COMMA value .) + RBRACKET reduce using rule 25 (values -> values COMMA value .) + COMMA reduce using rule 25 (values -> values COMMA value .) + BOOL reduce using rule 25 (values -> values COMMA value .) + BYTE reduce using rule 25 (values -> values COMMA value .) + SHORT reduce using rule 25 (values -> values COMMA value .) + FLOAT reduce using rule 25 (values -> values COMMA value .) + DOUBLE reduce using rule 25 (values -> values COMMA value .) + LONG reduce using rule 25 (values -> values COMMA value .) + INTEGER reduce using rule 25 (values -> values COMMA value .) + STRING reduce using rule 25 (values -> values COMMA value .) + LBRACE reduce using rule 25 (values -> values COMMA value .) + LBRACKET reduce using rule 25 (values -> values COMMA value .) -state 37 +state 38 - (21) array -> LBRACKET NAME SEMICOLON values . RBRACKET - (23) values -> values . value - (24) values -> values . COMMA value + (22) array -> LBRACKET NAME SEMICOLON values . RBRACKET + (24) values -> values . value + (25) values -> values . COMMA value (9) value -> . compound (10) value -> . list (11) value -> . array (12) value -> . BOOL (13) value -> . BYTE (14) value -> . SHORT - (15) value -> . DOUBLE - (16) value -> . LONG - (17) value -> . INTEGER - (18) value -> . STRING + (15) value -> . FLOAT + (16) value -> . DOUBLE + (17) value -> . LONG + (18) value -> . INTEGER + (19) value -> . STRING (2) compound -> . LBRACE key_value_pairs RBRACE (3) compound -> . LBRACE RBRACE - (19) list -> . LBRACKET values RBRACKET - (20) list -> . LBRACKET RBRACKET - (21) array -> . LBRACKET NAME SEMICOLON values RBRACKET - (22) array -> . LBRACKET NAME SEMICOLON RBRACKET + (20) list -> . LBRACKET values RBRACKET + (21) list -> . LBRACKET RBRACKET + (22) array -> . LBRACKET NAME SEMICOLON values RBRACKET + (23) array -> . LBRACKET NAME SEMICOLON RBRACKET - RBRACKET shift and go to state 39 - COMMA shift and go to state 34 + RBRACKET shift and go to state 40 + COMMA shift and go to state 35 BOOL shift and go to state 19 BYTE shift and go to state 20 SHORT shift and go to state 21 - DOUBLE shift and go to state 22 - LONG shift and go to state 23 - INTEGER shift and go to state 24 - STRING shift and go to state 25 + FLOAT shift and go to state 22 + DOUBLE shift and go to state 23 + LONG shift and go to state 24 + INTEGER shift and go to state 25 + STRING shift and go to state 26 LBRACE shift and go to state 3 - LBRACKET shift and go to state 26 + LBRACKET shift and go to state 27 - value shift and go to state 33 + value shift and go to state 34 compound shift and go to state 16 list shift and go to state 17 array shift and go to state 18 -state 38 - - (22) array -> LBRACKET NAME SEMICOLON RBRACKET . - - RBRACE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - COMMA reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - NAME reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - STRING reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - RBRACKET reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - BOOL reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - BYTE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - SHORT reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - DOUBLE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - LONG reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - INTEGER reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - LBRACE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - LBRACKET reduce using rule 22 (array -> LBRACKET NAME SEMICOLON RBRACKET .) - - state 39 - (21) array -> LBRACKET NAME SEMICOLON values RBRACKET . - - RBRACE reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - COMMA reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - NAME reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - STRING reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - RBRACKET reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - BOOL reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - BYTE reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - SHORT reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - DOUBLE reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - LONG reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - INTEGER reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - LBRACE reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) - LBRACKET reduce using rule 21 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + (23) array -> LBRACKET NAME SEMICOLON RBRACKET . + + RBRACE reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + COMMA reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + NAME reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + STRING reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + RBRACKET reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + BOOL reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + BYTE reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + SHORT reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + FLOAT reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + DOUBLE reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + LONG reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + INTEGER reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + LBRACE reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + LBRACKET reduce using rule 23 (array -> LBRACKET NAME SEMICOLON RBRACKET .) + + +state 40 + + (22) array -> LBRACKET NAME SEMICOLON values RBRACKET . + + RBRACE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + COMMA reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + NAME reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + STRING reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + RBRACKET reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + BOOL reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + BYTE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + SHORT reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + FLOAT reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + DOUBLE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + LONG reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + INTEGER reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + LBRACE reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) + LBRACKET reduce using rule 22 (array -> LBRACKET NAME SEMICOLON values RBRACKET .) diff --git a/ftb_snbt_lib/parsetab.py b/ftb_snbt_lib/parsetab.py index 758d7a4..0c9f1fc 100644 --- a/ftb_snbt_lib/parsetab.py +++ b/ftb_snbt_lib/parsetab.py @@ -6,9 +6,9 @@ _lr_method = 'LALR' -_lr_signature = 'BOOL BYTE COLON COMMA DOUBLE INTEGER LBRACE LBRACKET LONG NAME RBRACE RBRACKET SEMICOLON SHORT STRINGsnbt : compoundcompound : LBRACE key_value_pairs RBRACE\n | LBRACE RBRACEkey_value_pairs : key_value_pairs key_value_pair\n | key_value_pairs COMMA key_value_pair\n | key_value_pairkey_value_pair : NAME COLON value\n | STRING COLON valuevalue : compound\n | list\n | array\n | BOOL\n | BYTE\n | SHORT\n | DOUBLE\n | LONG\n | INTEGER\n | STRINGlist : LBRACKET values RBRACKET\n | LBRACKET RBRACKETarray : LBRACKET NAME SEMICOLON values RBRACKET\n | LBRACKET NAME SEMICOLON RBRACKETvalues : values value\n | values COMMA value\n | value' +_lr_signature = 'BOOL BYTE COLON COMMA DOUBLE FLOAT INTEGER LBRACE LBRACKET LONG NAME RBRACE RBRACKET SEMICOLON SHORT STRINGsnbt : compoundcompound : LBRACE key_value_pairs RBRACE\n | LBRACE RBRACEkey_value_pairs : key_value_pairs key_value_pair\n | key_value_pairs COMMA key_value_pair\n | key_value_pairkey_value_pair : NAME COLON value\n | STRING COLON valuevalue : compound\n | list\n | array\n | BOOL\n | BYTE\n | SHORT\n | FLOAT\n | DOUBLE\n | LONG\n | INTEGER\n | STRINGlist : LBRACKET values RBRACKET\n | LBRACKET RBRACKETarray : LBRACKET NAME SEMICOLON values RBRACKET\n | LBRACKET NAME SEMICOLON RBRACKETvalues : values value\n | values COMMA value\n | value' -_lr_action_items = {'LBRACE':([0,5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[3,-3,-2,3,3,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,3,3,-20,-25,-19,-23,3,3,-24,3,-22,-21,]),'$end':([1,2,5,9,],[0,-1,-3,-2,]),'RBRACE':([3,4,5,6,9,10,14,15,16,17,18,19,20,21,22,23,24,25,27,29,32,38,39,],[5,9,-3,-6,-2,-4,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-8,-20,-19,-22,-21,]),'NAME':([3,4,5,6,9,10,11,14,15,16,17,18,19,20,21,22,23,24,25,26,27,29,32,38,39,],[7,7,-3,-6,-2,-4,7,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,30,-8,-20,-19,-22,-21,]),'STRING':([3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,],[8,8,-3,-6,-2,-4,8,25,25,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,25,-8,25,-20,-25,-19,-23,25,25,-24,25,-22,-21,]),'COMMA':([4,5,6,9,10,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,31,32,33,36,37,38,39,],[11,-3,-6,-2,-4,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-8,34,-20,-25,-19,-23,-24,34,-22,-21,]),'RBRACKET':([5,9,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,35,36,37,38,39,],[-3,-2,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,29,32,-20,-25,-19,-23,38,-24,39,-22,-21,]),'BOOL':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[-3,-2,19,19,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,19,19,-20,-25,-19,-23,19,19,-24,19,-22,-21,]),'BYTE':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[-3,-2,20,20,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,20,20,-20,-25,-19,-23,20,20,-24,20,-22,-21,]),'SHORT':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[-3,-2,21,21,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,21,21,-20,-25,-19,-23,21,21,-24,21,-22,-21,]),'DOUBLE':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[-3,-2,22,22,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,22,22,-20,-25,-19,-23,22,22,-24,22,-22,-21,]),'LONG':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[-3,-2,23,23,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,23,23,-20,-25,-19,-23,23,23,-24,23,-22,-21,]),'INTEGER':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[-3,-2,24,24,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,24,24,-20,-25,-19,-23,24,24,-24,24,-22,-21,]),'LBRACKET':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,28,29,31,32,33,34,35,36,37,38,39,],[-3,-2,26,26,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,26,26,-20,-25,-19,-23,26,26,-24,26,-22,-21,]),'COLON':([7,8,],[12,13,]),'SEMICOLON':([30,],[35,]),} +_lr_action_items = {'LBRACE':([0,5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[3,-3,-2,3,3,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,3,3,-21,-26,-20,-24,3,3,-25,3,-23,-22,]),'$end':([1,2,5,9,],[0,-1,-3,-2,]),'RBRACE':([3,4,5,6,9,10,14,15,16,17,18,19,20,21,22,23,24,25,26,28,30,33,39,40,],[5,9,-3,-6,-2,-4,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-8,-21,-20,-23,-22,]),'NAME':([3,4,5,6,9,10,11,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30,33,39,40,],[7,7,-3,-6,-2,-4,7,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,31,-8,-21,-20,-23,-22,]),'STRING':([3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,36,37,38,39,40,],[8,8,-3,-6,-2,-4,8,26,26,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,26,-8,26,-21,-26,-20,-24,26,26,-25,26,-23,-22,]),'COMMA':([4,5,6,9,10,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,32,33,34,37,38,39,40,],[11,-3,-6,-2,-4,-5,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-8,35,-21,-26,-20,-24,-25,35,-23,-22,]),'RBRACKET':([5,9,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,36,37,38,39,40,],[-3,-2,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,30,33,-21,-26,-20,-24,39,-25,40,-23,-22,]),'BOOL':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,19,19,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,19,19,-21,-26,-20,-24,19,19,-25,19,-23,-22,]),'BYTE':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,20,20,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,20,20,-21,-26,-20,-24,20,20,-25,20,-23,-22,]),'SHORT':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,21,21,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,21,21,-21,-26,-20,-24,21,21,-25,21,-23,-22,]),'FLOAT':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,22,22,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,22,22,-21,-26,-20,-24,22,22,-25,22,-23,-22,]),'DOUBLE':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,23,23,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,23,23,-21,-26,-20,-24,23,23,-25,23,-23,-22,]),'LONG':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,24,24,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,24,24,-21,-26,-20,-24,24,24,-25,24,-23,-22,]),'INTEGER':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,25,25,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,25,25,-21,-26,-20,-24,25,25,-25,25,-23,-22,]),'LBRACKET':([5,9,12,13,16,17,18,19,20,21,22,23,24,25,26,27,29,30,32,33,34,35,36,37,38,39,40,],[-3,-2,27,27,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,27,27,-21,-26,-20,-24,27,27,-25,27,-23,-22,]),'COLON':([7,8,],[12,13,]),'SEMICOLON':([31,],[36,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): @@ -17,7 +17,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'snbt':([0,],[1,]),'compound':([0,12,13,26,28,34,35,37,],[2,16,16,16,16,16,16,16,]),'key_value_pairs':([3,],[4,]),'key_value_pair':([3,4,11,],[6,10,14,]),'value':([12,13,26,28,34,35,37,],[15,27,31,33,36,31,33,]),'list':([12,13,26,28,34,35,37,],[17,17,17,17,17,17,17,]),'array':([12,13,26,28,34,35,37,],[18,18,18,18,18,18,18,]),'values':([26,35,],[28,37,]),} +_lr_goto_items = {'snbt':([0,],[1,]),'compound':([0,12,13,27,29,35,36,38,],[2,16,16,16,16,16,16,16,]),'key_value_pairs':([3,],[4,]),'key_value_pair':([3,4,11,],[6,10,14,]),'value':([12,13,27,29,35,36,38,],[15,28,32,34,37,32,34,]),'list':([12,13,27,29,35,36,38,],[17,17,17,17,17,17,17,]),'array':([12,13,27,29,35,36,38,],[18,18,18,18,18,18,18,]),'values':([27,36,],[29,38,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): @@ -41,15 +41,16 @@ ('value -> BOOL','value',1,'p_value','parse.py',39), ('value -> BYTE','value',1,'p_value','parse.py',40), ('value -> SHORT','value',1,'p_value','parse.py',41), - ('value -> DOUBLE','value',1,'p_value','parse.py',42), - ('value -> LONG','value',1,'p_value','parse.py',43), - ('value -> INTEGER','value',1,'p_value','parse.py',44), - ('value -> STRING','value',1,'p_value','parse.py',45), - ('list -> LBRACKET values RBRACKET','list',3,'p_list','parse.py',49), - ('list -> LBRACKET RBRACKET','list',2,'p_list','parse.py',50), - ('array -> LBRACKET NAME SEMICOLON values RBRACKET','array',5,'p_array','parse.py',57), - ('array -> LBRACKET NAME SEMICOLON RBRACKET','array',4,'p_array','parse.py',58), - ('values -> values value','values',2,'p_values','parse.py',65), - ('values -> values COMMA value','values',3,'p_values','parse.py',66), - ('values -> value','values',1,'p_values','parse.py',67), + ('value -> FLOAT','value',1,'p_value','parse.py',42), + ('value -> DOUBLE','value',1,'p_value','parse.py',43), + ('value -> LONG','value',1,'p_value','parse.py',44), + ('value -> INTEGER','value',1,'p_value','parse.py',45), + ('value -> STRING','value',1,'p_value','parse.py',46), + ('list -> LBRACKET values RBRACKET','list',3,'p_list','parse.py',50), + ('list -> LBRACKET RBRACKET','list',2,'p_list','parse.py',51), + ('array -> LBRACKET NAME SEMICOLON values RBRACKET','array',5,'p_array','parse.py',58), + ('array -> LBRACKET NAME SEMICOLON RBRACKET','array',4,'p_array','parse.py',59), + ('values -> values value','values',2,'p_values','parse.py',66), + ('values -> values COMMA value','values',3,'p_values','parse.py',67), + ('values -> value','values',1,'p_values','parse.py',68), ] diff --git a/ftb_snbt_lib/tag.py b/ftb_snbt_lib/tag.py index 9dd8d89..c5c4ab8 100644 --- a/ftb_snbt_lib/tag.py +++ b/ftb_snbt_lib/tag.py @@ -1,4 +1,4 @@ -__all__ = ["Base", "Numeric", "NumericInteger", "Byte", "Short", "Integer", "Long", "Double", "Bool", "String", "List", "Array", "Compound"] +__all__ = ["Base", "Numeric", "NumericInteger", "Byte", "Short", "Integer", "Float", "Long", "Double", "Bool", "String", "List", "Array", "Compound"] class InvalidTypeError(ValueError): def __init__(self, item, cls): @@ -58,6 +58,10 @@ class Long(NumericInteger): size = 8 suffix = "L" +class Float(Numeric, float): + __slots__ = () + suffix = "f" + class Double(Numeric, float): __slots__ = () suffix = "d" diff --git a/ftb_snbt_lib/token.py b/ftb_snbt_lib/token.py index c7eccf2..1ab26ac 100644 --- a/ftb_snbt_lib/token.py +++ b/ftb_snbt_lib/token.py @@ -9,6 +9,7 @@ "BOOL", "BYTE", "SHORT", + "FLOAT", "DOUBLE", "LONG", "INTEGER", @@ -60,6 +61,11 @@ def t_SHORT(t): t.value = Short(t.value[:-1]) return t +def t_FLOAT(t): + r'\-?[0-9]+\.[0-9]+f' + t.value = Float(t.value[:-1]) + return t + def t_DOUBLE(t): r'\-?[0-9]+\.[0-9]+d' t.value = Double(t.value[:-1])