thekevinscott commited on
Commit
ca9bb8b
·
verified ·
1 Parent(s): 74e93d5

Upload experiments v1, v2-models-effort, v2-tests-configuration as on disk 2026-11-11 (part 53)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/__init__.py +0 -0
  2. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/__pycache__/__init__.cpython-314.pyc +0 -0
  3. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/__init__.py +0 -0
  4. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/__pycache__/__init__.cpython-314.pyc +0 -0
  5. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__init__.py +0 -0
  6. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/__init__.cpython-314.pyc +0 -0
  7. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_grammars.cpython-314-pytest-9.1.1.pyc +0 -0
  8. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_iteration.cpython-314-pytest-9.1.1.pyc +0 -0
  9. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_iteration_with_additional_strings.cpython-314-pytest-9.1.1.pyc +0 -0
  10. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_iteration_with_an_initial_string.cpython-314-pytest-9.1.1.pyc +0 -0
  11. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_grammars.py +705 -0
  12. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_iteration.py +48 -0
  13. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_iteration_with_additional_strings.py +313 -0
  14. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_iteration_with_an_initial_string.py +235 -0
  15. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__init__.py +0 -0
  16. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__pycache__/__init__.cpython-314.pyc +0 -0
  17. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__pycache__/test_validate_grammar.cpython-314-pytest-9.1.1.pyc +0 -0
  18. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__pycache__/test_validate_input.cpython-314-pytest-9.1.1.pyc +0 -0
  19. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/test_validate_grammar.py +43 -0
  20. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/test_validate_input.py +168 -0
  21. v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/pyproject.toml +21 -0
  22. v2-models-effort/runs/20261028-095511-delicate-sound/proxy.log +15 -0
  23. v2-models-effort/runs/20261028-095511-delicate-sound/run.json +22 -0
  24. v2-models-effort/runs/20261028-095511-delicate-sound/stderr.log +36 -0
  25. v2-models-effort/runs/20261028-095511-delicate-sound/stderr.txt +1 -0
  26. v2-models-effort/runs/20261028-095511-delicate-sound/stdout.log +1 -0
  27. v2-models-effort/runs/20261028-095511-delicate-sound/transcript/.claude/projects/-target/bcce314f-c5c9-42a3-b6b7-b98e8f2df9b5.jsonl +0 -0
  28. v2-models-effort/runs/20261028-095511-dry-moon/credentials.log +42 -0
  29. v2-models-effort/runs/20261028-095511-dry-moon/manifest.json +105 -0
  30. v2-models-effort/runs/20261028-095511-dry-moon/memory.jsonl +288 -0
  31. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/.gitignore +7 -0
  32. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/README.md +106 -0
  33. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/__init__.py +26 -0
  34. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/gbnf.py +37 -0
  35. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/__init__.py +3 -0
  36. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/colorize.py +18 -0
  37. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/generic_set.py +47 -0
  38. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/get_input_as_code_points.py +8 -0
  39. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/get_parent_stack_id.py +18 -0
  40. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/get_serialized_rule_key.py +29 -0
  41. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/graph.py +182 -0
  42. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/graph_node.py +53 -0
  43. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/graph_pointer.py +122 -0
  44. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/parse_state.py +56 -0
  45. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/printer.py +82 -0
  46. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/rule_ref.py +36 -0
  47. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/type_guards.py +64 -0
  48. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/types.py +46 -0
  49. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_parser/__init__.py +3 -0
  50. v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_parser/build_rule_stack.py +75 -0
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/__init__.py ADDED
File without changes
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (136 Bytes). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/__init__.py ADDED
File without changes
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (146 Bytes). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__init__.py ADDED
File without changes
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (156 Bytes). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_grammars.cpython-314-pytest-9.1.1.pyc ADDED
Binary file (46.9 kB). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_iteration.cpython-314-pytest-9.1.1.pyc ADDED
Binary file (3.78 kB). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_iteration_with_additional_strings.cpython-314-pytest-9.1.1.pyc ADDED
Binary file (12.5 kB). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/__pycache__/test_iteration_with_an_initial_string.cpython-314-pytest-9.1.1.pyc ADDED
Binary file (9.96 kB). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_grammars.py ADDED
@@ -0,0 +1,705 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from gbnf import GBNF
4
+
5
+
6
+ def unescape(string: str) -> str:
7
+ return string.replace('\\n', '\n').replace('\\t', '\t')
8
+
9
+
10
+ GRAMMARS = {'arithmetic': 'root ::= (expr "=" ws term "\\n")+\\nexpr ::= term ([-+*/] term)*\\nterm ::= '
11
+ 'ident | num | "(" ws expr ")" ws\\nident ::= [a-z] [a-z0-9_]* ws\\nnum ::= '
12
+ '[0-9]+ ws\\nws ::= [ \\t\\n]*\\n',
13
+ 'c': 'root ::= (declaration)*\\n\\ndeclaration ::= dataType identifier "(" parameter? ")" "{" '
14
+ 'statement* "}"\\n\\ndataType ::= "int" ws | "float" ws | "char" ws\\nidentifier ::= '
15
+ '[a-zA-Z_] [a-zA-Z_0-9]*\\n\\nparameter ::= dataType identifier\\n\\nstatement ::=\\n ( '
16
+ 'dataType identifier ws "=" ws expression ";" ) |\\n ( identifier ws "=" ws expression '
17
+ '";" ) |\\n ( identifier ws "(" argList? ")" ";" ) |\\n ( "return" ws expression ";" ) '
18
+ '|\\n ( "while" "(" condition ")" "{" statement* "}" ) |\\n ( "for" "(" forInit ";" ws '
19
+ 'condition ";" ws forUpdate ")" "{" statement* "}" ) |\\n ( "if" "(" condition ")" "{" '
20
+ 'statement* "}" ("else" "{" statement* "}")? ) |\\n ( singleLineComment ) |\\n ( '
21
+ 'multiLineComment )\\n\\nforInit ::= dataType identifier ws "=" ws expression | identifier '
22
+ 'ws "=" ws expression\\nforUpdate ::= identifier ws "=" ws expression\\n\\ncondition ::= '
23
+ 'expression relationOperator expression\\nrelationOperator ::= ("<=" | "<" | "==" | "!=" | '
24
+ '">=" | ">")\\n\\nexpression ::= term (("+" | "-") term)*\\nterm ::= factor(("*" | "/") '
25
+ 'factor)*\\n\\nfactor ::= identifier | number | unaryTerm | funcCall | '
26
+ 'parenExpression\\nunaryTerm ::= "-" factor\\nfuncCall ::= identifier "(" argList? '
27
+ '")"\\nparenExpression ::= "(" ws expression ws ")"\\n\\nargList ::= expression ("," ws '
28
+ 'expression)*\\n\\nnumber ::= [0-9]+\\n\\nsingleLineComment ::= "//" [^\\n]* '
29
+ '"\\n"\\nmultiLineComment ::= "/*" ( [^*] | ("*" [^/]) )* "*/"\\n\\nws ::= ([ \\t\\n]+)\\n',
30
+ 'chess': '# Specifies chess moves as a list in algebraic notation, using PGN conventions\\n\\n# '
31
+ 'Force first move to "1. ", then any 1-2 digit number after, relying on model to follow '
32
+ 'the pattern\\nroot ::= "1. " move " " move "\\n" ([1-9] [0-9]? ". " move " " move '
33
+ '"\\n")+\\nmove ::= (pawn | nonpawn | castle) [+#]?\\n\\n# piece type, optional '
34
+ 'file/rank, optional capture, dest file & rank\\nnonpawn ::= [NBKQR] [a-h]? [1-8]? "x"? '
35
+ '[a-h] [1-8]\\n\\n# optional file & capture, dest file & rank, optional '
36
+ 'promotion\\npawn ::= ([a-h] "x")? [a-h] [1-8] ("=" [NBKQR])?\\n\\ncastle ::= "O-O" '
37
+ '"-O"?\\n',
38
+ 'japanese': '# A probably incorrect grammar for Japanese\\nroot ::= jp-char+ ([ \\t\\n] '
39
+ 'jp-char+)*\\njp-char ::= hiragana | katakana | punctuation | cjk\\nhiragana '
40
+ '::= [ぁ-ゟ]\\nkatakana ::= [ァ-ヿ]\\npunctuation ::= [、-〾]\\ncjk ::= [一-鿿]\\n',
41
+ 'json-arr': '# This is the same as json.gbnf but we restrict whitespaces at the end of the root '
42
+ 'array\\n# Useful for generating JSON arrays\\n\\nroot ::= arr\\nvalue ::= object '
43
+ '| array | string | number | ("true" | "false" | "null") ws\\n\\narr ::=\\n "[\\n" '
44
+ 'ws (\\n value\\n (",\\n" ws value)*\\n )? "]"\\n\\nobject ::=\\n "{" '
45
+ 'ws (\\n string ":" ws value\\n ("," ws string ":" ws value)*\\n )? '
46
+ '"}" ws\\n\\narray ::=\\n "[" ws (\\n value\\n ("," ws value)*\\n )? '
47
+ '"]" ws\\n\\nstring ::=\\n "\\"" (\\n [^"\\\\\\x7F\\x00-\\x1F] |\\n "\\\\" '
48
+ '(["\\\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes\\n '
49
+ ')* "\\"" ws\\n\\nnumber ::= ("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? '
50
+ '[0-9]+)? ws\\n\\n# Optional space: by convention, applied in this grammar after '
51
+ 'literal chars when allowed\\nws ::= ([ \\t\\n] ws)?\\n',
52
+ 'json': 'root ::= object\\nvalue ::= object | array | string | number | ("true" | "false" | '
53
+ '"null") ws\\n\\nobject ::=\\n "{" ws (\\n string ":" ws value\\n ("," ws '
54
+ 'string ":" ws value)*\\n )? "}" ws\\n\\narray ::=\\n "[" ws (\\n '
55
+ 'value\\n ("," ws value)*\\n )? "]" ws\\n\\nstring ::=\\n "\\"" (\\n '
56
+ '[^"\\\\\\x7F\\x00-\\x1F] |\\n "\\\\" (["\\\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] '
57
+ '[0-9a-fA-F] [0-9a-fA-F]) # escapes\\n )* "\\"" ws\\n\\nnumber ::= ("-"? ([0-9] | [1-9] '
58
+ '[0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? ws\\n\\n# Optional space: by convention, '
59
+ 'applied in this grammar after literal chars when allowed\\nws ::= ([ \\t\\n] ws)?\\n\\n',
60
+ 'list': 'root ::= item+\\n\\n# Excludes various line break characters\\nitem ::= "- " '
61
+ '[^\\r\\n\\x0b\\x0c\\x85\\u2028\\u2029]+ "\\n"\\n',
62
+ 'simple': 'root ::= (expr "=" term "\\n")+\\nexpr ::= term ([-+*/] term)*\\nterm ::= [0-9]+\\n'}
63
+
64
+ CASES = [['arithmetic', '1'],
65
+ ['arithmetic', '1 +'],
66
+ ['arithmetic', 'and'],
67
+ ['arithmetic', '1 +2'],
68
+ ['arithmetic', '1 +2+'],
69
+ ['arithmetic', '1 +2=3'],
70
+ ['arithmetic', '1 +2 +3'],
71
+ ['arithmetic', '1 +2= 3'],
72
+ ['arithmetic', '1 +2 =3'],
73
+ ['arithmetic', '1 +2 = 3'],
74
+ ['arithmetic', '1 +2*3=9'],
75
+ ['arithmetic', '1 +2+3=6'],
76
+ ['arithmetic', '1 +2 *3=9'],
77
+ ['arithmetic', '1 +2+3 = 6'],
78
+ ['arithmetic', '3 +4*5= 23'],
79
+ ['arithmetic', '1 +2*3 = 9'],
80
+ ['arithmetic', '1 +2 /3*4 ='],
81
+ ['arithmetic', '1 +2 *3 = 9'],
82
+ ['arithmetic', '2 +3 *4 =14'],
83
+ ['arithmetic', '2 +3 *4 = 14'],
84
+ ['arithmetic', '2 +5 *4 = 26'],
85
+ ['arithmetic', '(1)\\n -3 +2 *5 =\\n (2)'],
86
+ ['arithmetic', '3\\n\\n *args *nums = list'],
87
+ ['arithmetic', '3\\n \\n *hint*1 +2 *3 = 1'],
88
+ ['arithmetic', '1 +2 *3 = 9\\n \\n \\n \\n\\n2-5'],
89
+ ['arithmetic', '3\\n -2 +1\\n\\n *a *b -c = d'],
90
+ ['arithmetic', '3\\n -3\\n \\n *args -args = 0'],
91
+ ['arithmetic', '3\\n \\n *args -a\\n \\n *args -f'],
92
+ ['arithmetic', 'and\\n \\n \\n \\n -2 *(1 -3) +4 = 2'],
93
+ ['arithmetic', 'and\\n\\n *args -var_name\\n -1 = args0'],
94
+ ['arithmetic', '3\\n\\n *hint*(1)\\n *looks_like_this\\n *is_valid'],
95
+ ['arithmetic', '(invalid)\\n \\n *valid*(non-answer)\\n \\n *valid*(answer)'],
96
+ ['arithmetic', '(a) -2 *3\\n -4\\n \\n *4\\n -16\\n \\n *6\\n -36\\n \\n /3 \\n -3'],
97
+ ['arithmetic', '2\\n \\n *hint*1-10\\n\\n *hint*11-14\\n\\n *hint*15-17\\n\\n *hint*18-21'],
98
+ ['arithmetic', '3+7/2*5\\n \\n *(numbers) = (number1 +number2 +number3+number4 +number5)'],
99
+ ['arithmetic',
100
+ '4\\n \\n *hint*(donot /use/operator)\\n \\n *hint*(try-using-input-function)\\n \\n '
101
+ '*hint*(try-using-if-'],
102
+ ['arithmetic',
103
+ '3\\n \\n *hint*(you *might*want*to *look*at *the*order-of-operations)\\n\\n *hint*(you '
104
+ '*might*want*to *use*a *'],
105
+ ['arithmetic',
106
+ '3\\n \\n *hint*(you *can*use *and*or)\\n\\n *hint*(you *can*use *and*or)\\n \\n *hint*(you '
107
+ '*can*use *and*or)\\n \\n *'],
108
+ ['c', 'i'],
109
+ ['c', 'int'],
110
+ ['c', 'int thati'],
111
+ ['c', 'int theta(f'],
112
+ ['c', 'int todo_list('],
113
+ ['c', 'int to(int a){'],
114
+ ['c', 'int takessinput'],
115
+ ['c', 'int thatikssllll'],
116
+ ['c', 'int toinflate(char s1'],
117
+ ['c', 'int that(int it){iint'],
118
+ ['c', 'int that(int that){}int'],
119
+ ['c', 'int that(int a){int i ='],
120
+ ['c', 'int that(int a){int i = 0'],
121
+ ['c', 'int thatehsesgbeorhtuCcie'],
122
+ ['c', 'int i3(int i2){return i2*i2;}'],
123
+ ['c', 'int todo(int a){//a is the input of'],
124
+ ['c', 'int that1s2n3d4n5g6r7h8o9p10a11w12b'],
125
+ ['c', 'int theta(char orc){//your code here'],
126
+ ['c', 'int thatlllllllllllllllllllllllllllll'],
127
+ ['c', 'int thatiSslllwllllllllllllllllllllllll'],
128
+ ['c', 'int thatprint(){printf (fputs(array, p));}int'],
129
+ ['c', 'int thatiSsolveIt(int x){return x*x;}int main'],
130
+ ['c', 'char s1_arr1(int n){return (char*( ( char )-n+'],
131
+ ['c', "int thatprintoutrandomwordsandalphabet(){// i've"],
132
+ ['c', 'int thatiksssttststststststst_stststststitststst'],
133
+ ['c', 'int thatiksniponkimvssmhllmohlwvnfosrqxqyfqjrthmfkmn'],
134
+ ['c', 'float a(int b){return (b+1);}float z(int y){return (( ( float'],
135
+ ['c', 'int thatsntttinglytough(char\\n isnttnglytough){}int main(){char'],
136
+ ['c', 'char\\n\\nAqeel123456erjfkehkjhkdfjklefkgfgjfgiifjgfhkfekfgdfegfgeff'],
137
+ ['c', 'int main(){}int sum(int a){return a;}int product(int a){return a;}'],
138
+ ['c', 'int todo(){char c = getchar();}int main(){while(1==1){int i = 0;int j'],
139
+ ['c', 'int thatikssllllllllllllllllllllllllllllllllllllllllllllllllllllllllll'],
140
+ ['c', 'int todo(int n){}int todo(int n){}int todo(int n){}int todo(int n){}int'],
141
+ ['c', 'int thatikssllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll'],
142
+ ['c', 'int\\n movzxqyhw0xmm(int I32){xmm2d0xmm_setzero_ps16_pmu_ps1_ps1_ps1_ps1_ps'],
143
+ ['c', 'char\\n dvcs_xl_a2hk9y8q4o3dsf1m5n6v7uwxyz87654321jklmnpqrstuvwxyzabcdeghij'],
144
+ ['c', 'int thatllprintoutthenumberoftimesthateachletterappearsinaString(char str1){'],
145
+ ['c', 'int that(int that){}int that(int that){}int that(int that){}int that(int that)'],
146
+ ['c', 'int main(){}char\\n HowdyaDongledoIknowthatcharliehatesprogramming(int a){char b'],
147
+ ['c', 'int youroostedsirnstedssirntnsrirtrsdtrrsdsdtrrssdrtrsrdtsrrrtssrtrdsrtsrttrdtsr'],
148
+ ['c', 'int main(int argc){//here\\nreturn 0;//and here\\n}int my_program(char c){//here\\nif ('],
149
+ ['c', 'int thatasksforanythingbutwhatevahtmlandwhatevsomethingmoreplease(int dont){}char my'],
150
+ ['c', 'int i3(int i2){return i2*i2;}int main(){int i1 = 0;for (inti2(0, 1000000000));i1 = i'],
151
+ ['c',
152
+ 'int thatprint(int a){printf\\n (a);}int main(){int i\\n = 1;do\\n (i--0);}int main(){int '
153
+ 'i\\n = 1;'],
154
+ ['c',
155
+ 'int that(int that){}int that(int that){}int that(int that){}int that(int that){}int that(int '
156
+ 'that){}'],
157
+ ['c',
158
+ 'int '
159
+ 'thatwillfindifistevennumberinaverylongintroductionstringofonehundreddigitsormoreandreturntheindexof'],
160
+ ['c',
161
+ 'int todo(int n){}int main(){int i = 0;int j = 1;while (j*j+i*i);}int main(){int i = 0;int j = '
162
+ '1;while ('],
163
+ ['c',
164
+ 'int '
165
+ 'thatiSsasssseeeeeeepyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'],
166
+ ['c',
167
+ 'int todo(int n){}int todo(int n){}int todo(int n){}int todo(int n){}int todo(int n){}int '
168
+ 'todo(int n){}i'],
169
+ ['c',
170
+ 'int ainted(int n){int i = 0;while (i*i+1);}int main(){printf_s\\n (int);return 0;}int '
171
+ 'fahrenheit2celsius('],
172
+ ['c',
173
+ 'int main(int argc){//argv[0] is name of file to be opened\\nreturn (0);//exit code, no '
174
+ 'errors\\n}int main(int argc){//argv['],
175
+ ['c',
176
+ 'int '
177
+ 'thatcomparesstringsinmemorywithoutallocatingmorespacethannecessarytoholdbothstringsoranyotherobjectsofthesamelengthandsofwhomit'],
178
+ ['c',
179
+ 'int thatlllbeoawesome(int a){return (a*2);}int main(){printf\\n (iintantielloawesome(5));}int '
180
+ 'thatlllbeoawesome(int a){return (a*2);}'],
181
+ ['c',
182
+ 'char str1(int n){strcpy (n, str);}int n(int s){printf (s);return 0;}int main(){char str = '
183
+ 'getchar();int i = 1;while(getchar()!=10){if(i'],
184
+ ['c',
185
+ 'int withing(int a){}char str1(int a){}int main(){}char str2(){return 0;}int i(){return 0;}int '
186
+ 'j(){return 1;}int k(){return 2;}int l(){return'],
187
+ ['c',
188
+ 'int that(int that){}char\\n '
189
+ 'WritemeakillerprogramintheClanguageagaininthatagaininthatagaininthatagaininthatagaininthatagaininthatagaininthatagainint'],
190
+ ['c',
191
+ 'char buffer1(int length){//length is inputted by user\\n}int main(){while(true!=fscanf(fp, '
192
+ 'buffer1)){printf_stdout (buffer);}return 0;}float x0(float n){'],
193
+ ['c',
194
+ 'int tokkenize(char str){}int tokkenize(char str){int i = 0;while (strlen(str)--and);return '
195
+ 'str;}int tokkenize(char str){int i = 0;while (strlen(str)--and'],
196
+ ['c',
197
+ 'int main(){}int main(int argc){}int main(){}int main(){}int main(){}int main(){}int main(){}int '
198
+ 'main(){}int main(){}int main(){}int main(){}int main(){}int'],
199
+ ['c',
200
+ 'int '
201
+ 'thatusesregexpandstoragesystemsincompatibilitiesbutalsoworksinotherprogramminglanguageslikepythonorjavascriptorpython3whichhavebeenaroundawhileandaremorecomfortabletousethanCbutstillwanttoc'],
202
+ ['c',
203
+ 'int thatllprintoutallthewordsinafilethatstartwiththesignaturestringofmychoice(int '
204
+ 'heresone){}int theordertheyappearinthefileandthenprintoutalltheotherwordsinthefileafterthat(int '
205
+ 'heresomeotherthing)'],
206
+ ['c',
207
+ 'int main(){//Program start\\nint num = 0;//variable for number of characters in input '
208
+ 'string.\\nchar c = 0;//Variable for single character read from input.\\nscanf_s (input, '
209
+ '100);//Scan a line of user-entered text into the array'],
210
+ ['c',
211
+ 'int '
212
+ 'thatllmmehmmmmmlllmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'],
213
+ ['chess', '1'],
214
+ ['chess', '1.'],
215
+ ['chess', '1. a'],
216
+ ['chess', '1. N1x'],
217
+ ['chess', '1. a1+ a'],
218
+ ['chess', '1. N1xh1'],
219
+ ['chess', '1. a1+ a2+'],
220
+ ['chess', '1. N1xh1+ N2'],
221
+ ['chess', '1. a1+ a2+\\n2.'],
222
+ ['chess', '1. a2+ b3\\n2. a'],
223
+ ['chess', '1. a2+ b3\\n2. a2'],
224
+ ['chess', '1. a1 b2\\n2. a1 b2'],
225
+ ['chess', '1. f1=N f2=N\\n2. f'],
226
+ ['chess', '1. a1 b2\\n2. a1 b2\\n3'],
227
+ ['chess', '1. a2+ b3\\n2. a2+ b4\\n3.'],
228
+ ['chess', '1. a2+ b3\\n2. a2+ b3\\n3.'],
229
+ ['chess', '1. N2xh3+ h4=N\\n2. N2xh3'],
230
+ ['chess', '1. N2xh3+ h4=N\\n2. N2xh3+'],
231
+ ['chess', '1. N2xh1+ N2xh2+\\n2. N2xh1'],
232
+ ['chess', '1. N2xh1+ N2xh2+\\n2. N2xh1+'],
233
+ ['chess', '1. a4 b5\\n2. a3 b4\\n3. a4 b4'],
234
+ ['chess', '1. Ref1 Ref2\\n2. Ref3 Ref4\\n3'],
235
+ ['chess', '1. a3+ c4+\\n2. a3+ b5+\\n3. d2+'],
236
+ ['chess', '1. a2+ b3\\n2. a2+ b3\\n3. a2+ b3'],
237
+ ['chess', '1. N1d2 N3f4\\n2. f1+ N2e2\\n3. f1+ N'],
238
+ ['chess', '1. N1xg1+ N2xg2+\\n2. N1xg1+ N2xg2+'],
239
+ ['chess', '1. a1+ a2+\\n2. a1+ a2+\\n3. a1+ a2+\\n4'],
240
+ ['chess', '1. N2xb3+ N4xa2\\n2. N5xb1+ N6xb2\\n3.'],
241
+ ['chess', '1. a4+ a5\\n2. a4+ a6\\n3. a4+ a7\\n4. a4+'],
242
+ ['chess', '1. a4+ b3\\n2. a5+ b4\\n3. a6+ b5\\n4. a7+ b'],
243
+ ['chess', '1. a4+ a5\\n2. a4+ a6\\n3. a4+ a7\\n4. a4+ a'],
244
+ ['chess', '1. a1+ a2\\n2. b1+ b2\\n3. c1+ c2\\n4. d1+ d2'],
245
+ ['chess', '1. a1+ b2=N\\n2. c1+ d2=N\\n3. e1+ f2=N\\n4. g1+'],
246
+ ['chess', '1. N2xh2+ N3xh3\\n2. N2xh2+ N4xh4\\n3. N2xh2+ N'],
247
+ ['chess', '1. a1 b2\\n2. a1 a2\\n3. a1 b2\\n4. a1 a2\\n5. a1 b2\\n6'],
248
+ ['chess', '1. a4+ b3\\n2. a4+ b3\\n3. a4+ b3\\n4. a4+ b3\\n5. a4+ b'],
249
+ ['chess', '1. a2+ b3\\n2. a2+ b3\\n3. a2+ b3\\n4. a2+ b3\\n5. a2+ b3'],
250
+ ['chess', '1. a4=B b8=B\\n2. b3=B+ Bc4\\n3. c6=B+ Bf5\\n4. c1=B+ B'],
251
+ ['chess', '1. a2+ a3\\n2. a2+ a3+\\n3. a2+ a3+\\n4. a2+ a3+\\n5. a2+'],
252
+ ['chess', '1. a3 b2\\n2. c1 d2\\n3. e3 f4\\n4. g5 h6\\n5. a1 b1\\n6. a3'],
253
+ ['chess', '1. a1 a2\\n2. a1 b1\\n3. a1 c1\\n4. a1 d1\\n5. a1 e1\\n6. a1'],
254
+ ['chess', '1. N2h4 a3\\n2. N2h4 a3\\n3. N2h4 a3\\n4. N2h4 a3\\n5. N2h4'],
255
+ ['chess', '1. b2+ a2\\n2. c2+ d2\\n3. c4+ d4\\n4. a3+ b3\\n5. c7+ d7\\n6. a'],
256
+ ['chess', '1. N2a4+ b4\\n2. N2b3+ c2\\n3. a2 b2\\n4. a2 b3\\n5. a2 b2\\n6. a'],
257
+ ['chess', '1. N2xg3+ N4xg5+\\n2. N2xg3+ N4xg5+\\n3. N2xg3+ N4xg5+\\n4. N2'],
258
+ ['chess', '1. a1+ b2=N\\n2. a1+ b2=N\\n3. a1+ b2=N\\n4. a1+ b2=N\\n5. a1+ b2'],
259
+ ['chess', '1. N1xh1 N2xh2\\n2. h1+ h2+\\n3. h1+ h2+\\n4. h1+ h2+\\n5. h1+ h2+'],
260
+ ['chess', '1. b4 b3\\n2. a5 a4\\n3. a3 a4\\n4. a4 b4\\n5. a2 a1\\n6. a4 a3\\n7. a'],
261
+ ['chess', '1. a1+ b2\\n2. a1+ b2\\n3. a1+ b2\\n4. a1+ b2\\n5. a1+ b2\\n6. a1+ b2'],
262
+ ['chess', '1. a2+ a3\\n2. a1+ a2+\\n3. a1+ a2+\\n4. a1+ a2+\\n5. a1+ a2+\\n6. a1+'],
263
+ ['chess', '1. N2xh2+ N3xh3+\\n2. N2xh2+ N3xh3+\\n3. N2xh2+ N3xh3+\\n4. N2xh2+ N'],
264
+ ['chess', '1. a1+ a2+\\n2. b1+ b2+\\n3. c1+ c2+\\n4. d1+ d2+\\n5. e1+ e2+\\n6. f1+ f'],
265
+ ['chess', '1. a1+ a2+\\n2. c1=B+ Bxc2\\n3. a2+ bxb2=B+\\n4. a2+ bxb2=B+\\n5. a2+ b'],
266
+ ['chess', '1. a2+ b3+\\n2. a2+ b4+\\n3. a2+ b5+\\n4. a2+ b6+\\n5. a2+ b7+\\n6. a2+ b8+\\n7.'],
267
+ ['chess', '1. a1+ a2=B\\n2. b1+ b2=B\\n3. c1+ c2=B\\n4. d1+ d2=B\\n5. e1+ e2=B\\n6. f1+ f'],
268
+ ['chess', '1. a2+ b2\\n2. a2+ b2\\n3. a2+ b2\\n4. a2+ b2\\n5. a2+ b2\\n6. a2+ b2\\n7. a2+ b2\\n8'],
269
+ ['chess', '1. N2xg3+ c4\\n2. a5+ b6=N\\n3. b7+ c8=N\\n4. c1+ d2=N\\n5. e3+ f4=N\\n6. g5+ h6=N'],
270
+ ['chess',
271
+ '1. a1 a2\\n2. a1 a2+\\n3. a1+ a2\\n4. a1 a2=B\\n5. a1+ a2=B\\n6. b1 a1\\n7. b1 a2=B\\n8'],
272
+ ['chess', '1. N1xa1+ N2xa2\\n2. b3=N+ Nb3\\n3. N1xa1+ b3\\n4. N1xa1+ N2xa2+\\n5. N1xa1+ b3+\\n6'],
273
+ ['chess',
274
+ '1. a2+ b3\\n2. a1+ b2\\n3. a1+ b2\\n4. a1+ b2\\n5. a1+ b2\\n6. a1+ b2\\n7. a1+ b2\\n8. a1'],
275
+ ['chess',
276
+ '1. a2+ b2\\n2. a3+ b3\\n3. a4+ b4\\n4. a5+ b5\\n5. a6+ b6\\n6. a7+ b7\\n7. a8+ b8\\n8. a8+ b'],
277
+ ['chess',
278
+ '1. Rea2 h5\\n2. f2 g3\\n3. h4 h4\\n4. f3 h3\\n5. h6 h8\\n6. g7 g7\\n7. g2 h4\\n8. h7 h6\\n9. h7 '
279
+ 'h'],
280
+ ['japanese', ''],
281
+ ['japanese', '漫'],
282
+ ['japanese', '横'],
283
+ ['japanese', '書'],
284
+ ['japanese', '江戸の'],
285
+ ['japanese', '比較美'],
286
+ ['japanese', '《玉の恋'],
287
+ ['japanese', '《美女之花'],
288
+ ['japanese', '唱歌。\\n怎么'],
289
+ ['japanese', '《美しき日本'],
290
+ ['japanese', '洋の東方の詩を'],
291
+ ['japanese', '比較美好的品牌'],
292
+ ['japanese', '涙湯したい唄がす'],
293
+ ['japanese', '江戸の詩がいつも'],
294
+ ['japanese', '《花月秋》\\n《花月'],
295
+ ['japanese', '満有のメインが「あな'],
296
+ ['japanese', '美しい日本語詩をつくる'],
297
+ ['japanese', '《花月等》\\n《黄金曲》'],
298
+ ['japanese', '和えているのは、\\n《知ら'],
299
+ ['japanese', '紅花和優惠的漫步\\n《非性'],
300
+ ['japanese', '和美味良的短歌\\n。\\n。\\n。'],
301
+ ['japanese', '嫁ちゃんの花がいただき、\\n《'],
302
+ ['japanese', '毛菜のうたが、それは美しい日本'],
303
+ ['japanese', '《花果道》\\n【笑青春】\\n【笑青春'],
304
+ ['japanese', '《花糖果》\\n《花糖果》\\n《花糖果'],
305
+ ['japanese', 'ぬかりのうた しなむらんで、\\n《月'],
306
+ ['japanese', '比較美好的品牌\\n这个词是一个单词。'],
307
+ ['japanese', '。。。\\n」\\n「あなたは、お話を探して'],
308
+ ['japanese', '比較美好的品牌\\n。\\n。\\n。\\n。\\n。\\n。'],
309
+ ['japanese', '哀しい日本語詩を持つま\\n。\\n。\\n。\\n。'],
310
+ ['japanese', '山本美しい日詩\\n」\\n「おもちゃんと、そ'],
311
+ ['japanese', '和おうなへ\\n〈林英雄〉\\n〈美しい日光〉'],
312
+ ['japanese', '果にゃっちょんがま\\n。\\nただく悲しくので'],
313
+ ['japanese', '我想美国十大的曲\\n这样主要让歌手面自己可'],
314
+ ['japanese', '懸念のお風が強いほど谷中の日本詩をまとめて'],
315
+ ['japanese', '严愛華屬\\n十八年百月營用梅子錯誤 修正\\n十'],
316
+ ['japanese', '《美しい日本語詩》\\n《恋の花》\\n《風につきて'],
317
+ ['japanese', '先指一個最好的評論。\\n《研究科學和匯科文章目標'],
318
+ ['japanese', '澤島歌舞\\n。\\n。\\n。\\n「福島」。\\n「福島」。\\n「'],
319
+ ['japanese', '和おうなそれを言います。\\n知らないので、どこにもあ'],
320
+ ['japanese', '《美しい日本語詩》\\n《美しい日本語詩》\\n《美しい日'],
321
+ ['japanese', '美しい日本語詩をみた。\\n」\\n【終了】\\n「あなたは、この'],
322
+ ['japanese', '也为我想了悲症\\n来看我的夏天和春天\\n如此着高的海见这一'],
323
+ ['japanese', '華人語對咲香樂\\n經驗的拜情\\n只有一下容易思考\\n不要快速'],
324
+ ['japanese', '模板内容和古音与文字调整\\n《池沙气》。\\n【阳光流通线】'],
325
+ ['japanese', '小さな日本語の詩をつくても桜らしい。\\n今夕の日本語にある'],
326
+ ['japanese', '別詞を持っていると、それが美しい日本語です。\\n《絵文字の'],
327
+ ['japanese', '詩を大好きです。\\n这道题要求如下。\\n输入一个字符串。返回经'],
328
+ ['japanese', '《花の詩》\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。'],
329
+ ['japanese', '农村家が重い場所は\\n《夢にしてください》\\nわげてもない空気で、'],
330
+ ['japanese', '和美花の中で、母さんは\\n《華語》を読む。\\n《香港雜誌》書店に表示して'],
331
+ ['japanese', '哉きがわかるために\\n私は、ご果しますので、これに言う屋を\\n彼女となるん'],
332
+ ['japanese', '《華人語》\\n「あなたの夢を抱きしよう」\\n「ご飯は美味に好きです。」\\n「'],
333
+ ['japanese', '。\\n」\\n「そしては、お茶を食べることです。」\\n「どうも、それより美しいなら'],
334
+ ['japanese', '梅の詩がおいしいです。\\n」\\n「美の音は音となることを愛して、\\n唄によっても'],
335
+ ['japanese', '《美しい日本語詩》\\n《麻雨の花》\\n《花を持ってる》\\n《涙がやすくなり》\\n《'],
336
+ ['japanese', '和じゃないそうにして\\n《欲しい花の詩》\\n《美しき日本語の歌》\\n《華人の国》'],
337
+ ['japanese', '満美詩《歐裕のうた》\\n〈歐裕のうた〉\\n〈これらであるつまでがいるとなり〉\\n〈'],
338
+ ['japanese', '喜びないときは、それからも話者にする\\n《細胞の言うため》\\n「憂しくても君を願っ'],
339
+ ['japanese', '桜の詩がおいしい\\n。\\n居住地に私は、\\nあなたともころを見る\\n。\\n居住地に私は、'],
340
+ ['japanese', '美しい日本語の歌をまとめて\\n。\\n。\\n。\\nどうもなるのか\\nどれだけにありますよ。\\n沙に花があるこ'],
341
+ ['japanese',
342
+ '比較しておいたい\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。\\n。'],
343
+ ['json-arr', '['],
344
+ ['json-arr', '[\\n {'],
345
+ ['json-arr', '[\\n {\\n "'],
346
+ ['json-arr', '[\\n {\\n "name'],
347
+ ['json-arr', '[\\n {\\n "key":'],
348
+ ['json-arr', '[\\n {\\n "field1":'],
349
+ ['json-arr', '[\\n {"a":"b"},\\n {}\\n]'],
350
+ ['json-arr', '[\\n {\\n "name": "John'],
351
+ ['json-arr', '[\\n { "key": "value" }\\n ]'],
352
+ ['json-arr', '[\\n { "a": 1, "b": 2 }\\n ]'],
353
+ ['json-arr', '[\\n {\\n "name":"first",'],
354
+ ['json-arr', '[\\n {\\n "name": "John",'],
355
+ ['json-arr', '[\\n {\\n "key1": "value1",'],
356
+ ['json-arr', '[\\n {\\n "name": "A",\\n "'],
357
+ ['json-arr', '[\\n {\\n "name": "John",\\n "age'],
358
+ ['json-arr', '[\\n {\\n "name": "John",\\n "age":'],
359
+ ['json-arr', '[\\n {\\n "a": "b",\\n "c": [1,2,3],'],
360
+ ['json-arr', '[\\n {\\n "name": "John",\\n "age": 30,'],
361
+ ['json-arr', '[\\n {\\n "name": "John",\\n "age": 20,'],
362
+ ['json-arr', '[\\n {\\n "key": "value",\\n "other_stuff'],
363
+ ['json-arr', '[\\n {\\n "name": "John",\\n "age": 25,\\n "'],
364
+ ['json-arr', '[\\n "a",\\n "b",\\n { "c": true },\\n null,\\n "d'],
365
+ ['json-arr', '[\\n {"name": "John", "age": 23},\\n "dog",\\n 123,\\n ["foo"],'],
366
+ ['json-arr', '[\\n {\\n "name": "John",\\n "age": 30,\\n "city":'],
367
+ ['json-arr', '[\\n {\\n "id": "1",\\n "name": "some name"\\n }\\n ]'],
368
+ ['json-arr', '[\\n { "key" : "value", "some_other_key" : "another value"},'],
369
+ ['json-arr', '[\\n {\\n "key1": "value1",\\n "key2": [\\n "value'],
370
+ ['json-arr', '[\\n {"first_name":"A", "last_name":"B"},\\n "abcde12345"\\n ]'],
371
+ ['json-arr', '[\\n {"foo":1, "bar":["a","b"]},\\n {"foo2":[0,1]},\\n "string"]'],
372
+ ['json-arr', '[\\n {\\n "a": 1,\\n "b": 2\\n },\\n {\\n "c": 3\\n }'],
373
+ ['json-arr', '[\\n { "key1": "value1", "key2": "value2" },\\n { "key3": "value3'],
374
+ ['json-arr', '[\\n {\\n "key1": "value1",\\n "key2": "value2",\\n "key3":'],
375
+ ['json-arr', '[\\n { "id": 1, "name": "Bob" },\\n { "id": 2, "name": "Alice" }\\n ]'],
376
+ ['json-arr', '[\\n {\\n "name": "John",\\n "age": 30,\\n "city": "New York"'],
377
+ ['json-arr',
378
+ '[\\n {\\n "a": "1",\\n "b": "2",\\n "c": "3",\\n "d": "4",\\n "'],
379
+ ['json-arr',
380
+ '[\\n {\\n "name": "Bob",\\n "age": 40,\\n "email": "bob@example.com"'],
381
+ ['json-arr',
382
+ '[\\n {\\n "id": "1234",\\n "name": "John Doe"\\n },\\n {\\n "id": '
383
+ '"5678",'],
384
+ ['json-arr',
385
+ '[\\n {\\n "a": 1,\\n "b": 2,\\n "c": [3, 4]\\n },\\n {\\n "d": '
386
+ '5\\n }'],
387
+ ['json-arr',
388
+ '[\\n {\\n "id": 1,\\n "name": "John Doe",\\n "age": 30\\n },\\n '
389
+ '{\\n "id'],
390
+ ['json-arr',
391
+ '[\\n {\\n "key1": "value1",\\n "key2": "value2"\\n },\\n {\\n "key3": '
392
+ '"value'],
393
+ ['json-arr',
394
+ '[\\n {\\n "key": "value",\\n "anotherKey": "anotherValue"\\n },\\n {\\n '
395
+ '"key2": "'],
396
+ ['json-arr',
397
+ '[\\n {\\n "name": "John",\\n "age": 30,\\n "city": "New York"\\n },\\n '
398
+ '{\\n "name": "Jane'],
399
+ ['json-arr',
400
+ '[\\n {\\n "name": "John",\\n "age": 30,\\n "city": "New York"\\n },\\n '
401
+ '{\\n "name": "Jane",'],
402
+ ['json-arr',
403
+ '[\\n {\\n "name": "John",\\n "age": 20,\\n "address": "123 Main Street"\\n '
404
+ '},\\n {\\n "name":'],
405
+ ['json-arr',
406
+ '[\\n {\\n "key": "value",\\n "nested_key": 2,\\n "more_keys": [\\n '
407
+ '3,\\n 4,\\n 11\\n ]\\n }\\n]'],
408
+ ['json-arr',
409
+ '[\\n {\\n "name": "John",\\n "age": 30,\\n "city": "New York"\\n },\\n '
410
+ '{\\n "name": "Jane",\\n "age'],
411
+ ['json-arr',
412
+ '[\\n {\\n "key1": "value1",\\n "key2": "value2"\\n },\\n {\\n "key3": '
413
+ '"value3",\\n "key4": "value4"\\n }'],
414
+ ['json-arr',
415
+ '[\\n {\\n "name": "John",\\n "age": 21,\\n "friends": [\\n '
416
+ '{\\n "name": "Dave",\\n "age": 23'],
417
+ ['json-arr',
418
+ '[\\n {\\n "name": "John",\\n "age": 30,\\n "city": "New York"\\n },\\n '
419
+ '{\\n "name": "Jane",\\n "age": 25'],
420
+ ['json-arr',
421
+ '[\\n {\\n "name": "John",\\n "age": 20,\\n "city": "New York"\\n },\\n '
422
+ '{\\n "name": "Jane",\\n "age": 25,'],
423
+ ['json-arr',
424
+ '[\\n {\\n "key1": "value1",\\n "key2": "value2",\\n "key3": "value3"\\n '
425
+ '},\\n {\\n "key4": "value4",\\n "'],
426
+ ['json-arr',
427
+ '[\\n {\\n "key": "value",\\n "anotherKey": "another value"\\n },\\n '
428
+ '{\\n "anotherKey2": "yet another value"\\n }\\n ]'],
429
+ ['json-arr',
430
+ '[\\n {\\n "foo": "bar",\\n "other_info": {\\n "field": 1,\\n '
431
+ '"array": [1],\\n "boolean": true\\n },\\n "a'],
432
+ ['json-arr',
433
+ '[\\n {\\n "name": "John",\\n "age": 30,\\n "city": "New York"\\n },\\n '
434
+ '{\\n "name": "Peter",\\n "age": 40,\\n "city": "Berlin"'],
435
+ ['json-arr',
436
+ '[\\n {\\n "first_name": "Alice",\\n "last_name": "Jones",\\n "age": '
437
+ '25,\\n "occupation": "Engineer",\\n "address": {\\n "city": "New'],
438
+ ['json-arr',
439
+ '[\\n {\\n "name": "John",\\n "age": 30,\\n "city": "New York"\\n },\\n '
440
+ '{\\n "name": "Jane",\\n "age": 25,\\n "city": "Los Angeles"\\n }'],
441
+ ['json-arr',
442
+ '[\\n {\\n "name": "John",\\n "age": 20,\\n "address": {\\n "street": '
443
+ '"123 Main St.",\\n "city": "Anytown"\\n }\\n },\\n {\\n "name": "Jane",'],
444
+ ['json', '{'],
445
+ ['json', '{\\n "'],
446
+ ['json', '{\\n "first'],
447
+ ['json', '{\\n "foo":'],
448
+ ['json', '{\\n "key": "'],
449
+ ['json', '{\\n "key": "value'],
450
+ ['json', '{\\n "foo": "bar",'],
451
+ ['json', '{\\n "name": "John",'],
452
+ ['json', '{\\n "hello": "world",'],
453
+ ['json', '{\\n "key": "value",\\n "'],
454
+ ['json', '{\\n "key1": "value1",\\n "'],
455
+ ['json', '{\\n "key1": "value1",\\n "key'],
456
+ ['json', '{\\n "a": 1, "b": 2, "c": [3] }'],
457
+ ['json', '{\\n "test": "hello world",\\n "'],
458
+ ['json', '{\\n "name": "Joey",\\n "age": 32,'],
459
+ ['json', '{\\n "key1": "value1",\\n "key2": {'],
460
+ ['json', '{\\n "a": 1,\\n "b": 2,\\n "c": 3,'],
461
+ ['json', '{\\n "key": "value",\\n "other_key":'],
462
+ ['json', '{\\n "one": 1,\\n "two": 2,\\n "three'],
463
+ ['json', '{\\n "a": 1, "b": {\\n "c": 2\\n }\\n }'],
464
+ ['json', '{\\n "foo": "bar",\\n "baz": {\\n "qux":'],
465
+ ['json', '{\\n "name": "John",\\n "age": 30,\\n "city'],
466
+ ['json', '{\\n "a": 1,\\n "b": 2,\\n "c": true,\\n "'],
467
+ ['json', '{\\n "a": 1,\\n "b": 2,\\n "c": true,\\n "d'],
468
+ ['json', '{\\n "name": "John",\\n "age": 30,\\n "city":'],
469
+ ['json', '{\\n "key": "value",\\n "other key": [1, 2]\\n }'],
470
+ ['json', '{\\n "foo": "bar",\\n "baz": [1, 2, 3],\\n "boo":'],
471
+ ['json', '{\\n "key": "value",\\n "other_key": "other_value"'],
472
+ ['json', '{\\n "key": "value",\\n "anotherKey": "anotherValue"\\n }'],
473
+ ['json', '{\\n "name": "John",\\n "age": 30,\\n "isStudent": true\\n }'],
474
+ ['json', '{\\n "name": "John",\\n "age": 30,\\n "is_married": false\\n }'],
475
+ ['json', '{\\n "one": "a string",\\n "two": 3,\\n "three": ["list"]\\n }'],
476
+ ['json', '{\\n "one": "two",\\n "three": 4.3,\\n "five": ["six", 7]\\n }'],
477
+ ['json', '{\\n "key1": "value1",\\n "key2": {\\n "key3": "value3"\\n }'],
478
+ ['json', '{\\n "field1":"value1",\\n "field2":true,\\n "field3":["value4"],'],
479
+ ['json', '{\\n "foo": "bar",\\n "baz": true,\\n "some_array": [1, 2, 3]\\n }'],
480
+ ['json', '{\\n "key": "value",\\n "key2": {\\n "key3": "value3"\\n }\\n }'],
481
+ ['json', '{\\n "first": "name",\\n "second": {\\n "third": "value"\\n }\\n }'],
482
+ ['json', '{\\n "name": "John",\\n "age": 30,\\n "city": {\\n "state": "New York'],
483
+ ['json', '{"fizzbuzz": ["fizz", "fizz", "buzz"],\\n "evens": [4, 6],\\n "odds": [1, 3]}'],
484
+ ['json',
485
+ '{\\n "key1": "value1",\\n "key2": {\\n "subkey1": "subvalue1",\\n "subkey2":'],
486
+ ['json',
487
+ '{\\n "key1": "value1",\\n "key2": [1, 2, 3],\\n "key3": {\\n "key4": "value4",'],
488
+ ['json',
489
+ '{\\n "title": "My Title",\\n "content": "This is a sample paragraph.",\\n "tags":['],
490
+ ['json',
491
+ '{\\n "key1": "value1",\\n "key2": {\\n "subkey1": "subvalue1",\\n "subkey2": ['],
492
+ ['json',
493
+ '{\\n "key": "value",\\n "another key": [1, 2, 3],\\n "yet another": {\\n "more '
494
+ 'keys":'],
495
+ ['json',
496
+ '{\\n "key": "value",\\n "another-key": true,\\n "nested key": {\\n "a third": '
497
+ '"nested value'],
498
+ ['json',
499
+ '{\\n "key1": "value1",\\n "key2": {\\n "subkey1": "subvalue1",\\n "subkey2": '
500
+ '[\\n "sub'],
501
+ ['json',
502
+ '{\\n "key": "value",\\n "another_key": {\\n "yet_more_key": "whatever I want it to '
503
+ 'be."\\n }\\n }'],
504
+ ['json',
505
+ '{\\n "key1": "value1",\\n "key2": [1, 2],\\n "key3": {\\n "subkey1": '
506
+ '"subvalue1",\\n "subkey2":'],
507
+ ['json',
508
+ '{\\n "key1": "value1",\\n "key2": {\\n "subkey1": "subvalue1",\\n "subkey2": '
509
+ '"subvalue2"\\n }\\n }'],
510
+ ['json',
511
+ '{\\n "key": "value",\\n "another_key": "another_value",\\n\\n "object": {\\n '
512
+ '"some_property": 1,\\n "'],
513
+ ['json',
514
+ '{\\n "name": "John",\\n "age": 21,\\n "isEmployed": true,\\n "children": [\\n '
515
+ '{"name": "John Junior"}\\n ]\\n}'],
516
+ ['json',
517
+ '{\\n "type":"foo",\\n "name": "bar",\\n \\n "a":[\\n 1,2,3\\n ],\\n '
518
+ '"b":[\\n [],\\n 5,6\\n ]\\n }'],
519
+ ['json',
520
+ '{\\n "key": "value",\\n "another key": {\\n "more nested keys": [\\n "nested '
521
+ 'values"\\n ]\\n }\\n }'],
522
+ ['json',
523
+ '{\\n "name": "John",\\n "age": 30,\\n "isMarried": false,\\n "cars": [\\n '
524
+ '{\\n "make": "Ford",\\n "model'],
525
+ ['json',
526
+ '{\\n "hello": "world",\\n "fruits": ["apple", "orange"],\\n \\t"user": {\\n '
527
+ '"name": "Bob",\\n "age": 20,\\n \\t"'],
528
+ ['json',
529
+ '{\\n "data": "hello",\\n "age": 30,\\n "country": {\\n "state": '
530
+ '"California",\\n "city": "San Francisco"\\n }\\n }'],
531
+ ['json',
532
+ '{\\n "key1": "value1",\\n "key2": "value2",\\n "key3": {\\n "subkey1": '
533
+ '"subvalue1",\\n "subkey2": "subvalue2",\\n "subkey'],
534
+ ['json',
535
+ '{\\n "key": "value",\\n "a": [1, 2],\\n "b": true,\\n "c": {\\n "d": '
536
+ '1,\\n "e": {\\n "f": "g"\\n }\\n },\\n "'],
537
+ ['json',
538
+ '{\\n "key1": "value1",\\n "key2": {\\n "subkey1": "subvalue1",\\n "subkey2": '
539
+ '[\\n "subsubvalue1",\\n "subsubvalue2"'],
540
+ ['json',
541
+ '{\\n "name": "John",\\n "age": 23,\\n "address": {\\n "street": "123 Main '
542
+ 'St.",\\n "city": "Anytown",\\n "state": "CA",\\n "zipcode": "12345"'],
543
+ ['list', '-'],
544
+ ['list', '- a'],
545
+ ['list', '- a list'],
546
+ ['list', '- a list of'],
547
+ ['list', '- a list of cars.'],
548
+ ['list', '- a list of fruits'],
549
+ ['list', '- a list of fruits.'],
550
+ ['list', '- a list of sports.'],
551
+ ['list', '- a list of cities.'],
552
+ ['list', '- a list of colors.'],
553
+ ['list', '- a list of numbers.'],
554
+ ['list', '- a list of colors.\\n-'],
555
+ ['list', '- a list of car models.'],
556
+ ['list', '- a list of car brands.'],
557
+ ['list', '- a list of colors.\\n- Add'],
558
+ ['list', '- a list of music genres.'],
559
+ ['list', '- a list of fruits.\\n- If the'],
560
+ ['list', '- a list of programming languages.'],
561
+ ['list', '- a list of fruits.\\n- If the input is not'],
562
+ ['list', '- a list of books.\\n- What is the difference'],
563
+ ['list', '- a list of fruits.\\n- If the user enters "quit" or'],
564
+ ['list', '- a list of fruits.\\n- For example, if the input is:\\n-'],
565
+ ['list', '- a list of colors.\\n- `grocery`: the same as above, but'],
566
+ ['list', '- a list of fruits.\\n- The first item in the returned list'],
567
+ ['list', '- a list of fruits.\\n- If there is no such word, return "I don\'t know'],
568
+ ['list', '- a list of colors.\\n- Each item in the returned list has two properties'],
569
+ ['list', '- a list of fruits.\\n- If you want to get all the items from the grocery'],
570
+ ['list', '- a list of fruits.\\n- If the user enters "exit", return an empty list.\\n- If'],
571
+ ['list', "- a list of sports.\\n- Example:\\n- >>> grocery_list = ['Bread', 'Milk', 'Cheese']"],
572
+ ['list',
573
+ '- a list of fruits.\\n- If the input is not one of these, return an empty list.\\n- The'],
574
+ ['list',
575
+ '- a list of fruits.\\n- If the input is not one of these, return an empty list.\\n- The '
576
+ 'grocery'],
577
+ ['list',
578
+ '- a list of fruits.\\n- The function should return the empty list if it fails to find any item'],
579
+ ['list',
580
+ '- a list of fruits.\\n- Write some code that returns an empty list, so that we can test if the'],
581
+ ['list',
582
+ "- a list of cities.\\n- If the input is not in any of these categories, return 'Sorry, I don't "
583
+ "know that'."],
584
+ ['list',
585
+ "- a list of movies.\\n- We'll say that the words in this problem are all lowercase and there is "
586
+ 'no punctuation.'],
587
+ ['list',
588
+ '- a list of fruits.\\n- The list should be sorted alphabetically, except that the first item in '
589
+ 'the list is always "'],
590
+ ['list',
591
+ '- a list of fruits.\\n- If the user enters "quit", return an empty list.\\n- If the user enters '
592
+ 'anything else, return None.'],
593
+ ['list',
594
+ '- a list of fruits.\\n- If the user enters "quit", return an empty list.\\n- If the user enters '
595
+ 'any other word, ask them to'],
596
+ ['list',
597
+ '- a list of fruits.\\n- If the input is not one of these, return an empty list.\\n- The input '
598
+ 'can be any string.\\n- You may assume that'],
599
+ ['list',
600
+ '- a list of fruits.\\n- The first argument is the name of the category, and the second argument '
601
+ 'is a string that contains all items in that'],
602
+ ['list',
603
+ "- a list of fruits.\\n- If the user enters 'q', quit the program.\\n- If the user enters "
604
+ 'anything else, print an error message and ask again.\\n- Use'],
605
+ ['list',
606
+ '- a list of programming languages.\\n- Give me one of the following:\\n- the index of the '
607
+ 'first item in the list that matches my criteria, if there'],
608
+ ['list',
609
+ '- a list of planets.\\n- What is the purpose of the `if` statement?\\n- How can we modify the '
610
+ 'program to take multiple arguments and concatenate them into one'],
611
+ ['list',
612
+ '- a list of fruits.\\n- If the user enters "exit", return an empty list.\\n- If the user enters '
613
+ 'anything else, return None.\\n- The program should ask for input until'],
614
+ ['list',
615
+ '- a list of fruits.\\n- If the user enters "quit", return an empty list.\\n- If the user enters '
616
+ 'anything else, print an error message and ask again.\\n- Use a loop to keep asking until the '
617
+ 'user enters "quit".\\n- Use a'],
618
+ ['list',
619
+ '- a list of fruits.\\n- If the user enters "quit", return an empty list.\\n- If the user enters '
620
+ 'anything else, return None.\\n- The program should ask for input until the user enters '
621
+ '"quit".\\n- Use the `split()` method to split the'],
622
+ ['list',
623
+ '- a list of fruits.\\n- If the user enters "exit", return an empty list.\\n- If the user enters '
624
+ 'anything else, print an error message and ask again.\\n- Use a loop to keep asking until the '
625
+ 'user enters "exit".\\n- Use a dictionary to store the items'],
626
+ ['list',
627
+ '- a list of names.\\n- If the parameter is not a string, return me an empty list.\\n- If the '
628
+ 'parameter is "", then return me a list with all words in the English language.\\n- If the '
629
+ 'parameter contains only spaces, then return me a list with all words in the English'],
630
+ ['simple', '1'],
631
+ ['simple', '1+'],
632
+ ['simple', '1+2'],
633
+ ['simple', '1+2='],
634
+ ['simple', '3+5*2'],
635
+ ['simple', '1+2=3'],
636
+ ['simple', '3-2=1'],
637
+ ['simple', '3+4=7'],
638
+ ['simple', '2-5+3*'],
639
+ ['simple', '2-2=0\\n3'],
640
+ ['simple', '3+2=5\\n5/'],
641
+ ['simple', '1+2=3\\n2/4'],
642
+ ['simple', '1+2=3\\n2+3-'],
643
+ ['simple', '1+2=3\\n2/4=0'],
644
+ ['simple', '1+2=3\\n2/4=2'],
645
+ ['simple', '1/0=0\\n2-4+6-8'],
646
+ ['simple', '1+2=3\\n9-1*3/4=0'],
647
+ ['simple', '1/0=0\\n2-4+6-8*10'],
648
+ ['simple', '1/3=0\\n2*7-8+9=10\\n3'],
649
+ ['simple', '3+4*5-6/2=19\\n2-1*2+'],
650
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9'],
651
+ ['simple', '1/0=0\\n2-1=1\\n4/3=1\\n5+6'],
652
+ ['simple', '3/2+1/4=5\\n4/2*1/4-7/8=0'],
653
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3/5='],
654
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5=2'],
655
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-6/3+'],
656
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5+6=8'],
657
+ ['simple', '2-4=0\\n3-5+6=2\\n4*1/2+8=10\\n5+7-'],
658
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3+5-6=2\\n3'],
659
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5+6=4\\n7*'],
660
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5+7=5\\n4*6'],
661
+ ['simple', '3+4-5=2\\n10/2*5=25\\n1+2*3-4/2=7\\n5+6+'],
662
+ ['simple', '3+4-5=2\\n10/2*5=25\\n1+2*3-4/2=7\\n5+6+7'],
663
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5=2\\n6/3=2\\n7-8'],
664
+ ['simple', '2-3+4*5=21\\n3-1/2-3/4+1/8=0\\n4+12/4-6/'],
665
+ ['simple', '3+4=7\\n2-5=2\\n3*6=18\\n4/8=0\\n5-1=4\\n6*9=54\\n7'],
666
+ ['simple', '1/2+3=4\\n2/5*3=0\\n3-6/2=0\\n9/3+2=5\\n3+4/2=4'],
667
+ ['simple', '2-3=1\\n3-4=1\\n5+6/7=8\\n10*9-11/12=89\\n4+5*6-7/'],
668
+ ['simple', '3+4=7\\n2-1=1\\n3*2=6\\n5/5=1\\n4*3=12\\n3+2*8=23\\n5-'],
669
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5/6=0\\n4*8/4=8\\n7-10/3'],
670
+ ['simple', '5/6=0\\n9-9=0\\n3+4*2=14\\n1+8/3=5\\n10-2*5=0\\n7*8/2='],
671
+ ['simple', '3/4+1=0\\n2/5*6=1\\n3/10-8=0\\n4/9+2=5\\n5/7*7=5\\n6/8'],
672
+ ['simple', '2-5=4\\n3-8=5\\n4-6=2\\n5-7=2\\n6-9=3\\n7-10=1\\n8-11=3\\n9-'],
673
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5/6=0\\n4+7/8=10\\n5-6/7=4\\n6/7'],
674
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3/3=1\\n5-6=1\\n7+8=15\\n9-10=1\\n11-'],
675
+ ['simple', '2+3*4=14\\n3/5-1/10=0\\n4+15/3=9\\n5*6+7=37\\n8+8*3=40\\n4/2'],
676
+ ['simple', '3-5/8+1/2=1\\n4/3*6+7/9=29\\n5/3+8/6-7/9=24\\n0/3*6*7/9+1/2-5'],
677
+ ['simple', '2-3=1\\n3-4=1\\n5+6/7=8\\n4*5=20\\n6/9=0\\n10/12=0\\n11/13=0\\n17/19=1'],
678
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3/5=0\\n4-6=2\\n7+8=15\\n10-20=10\\n11-12=1\\n13'],
679
+ ['simple', '1-3+5*4/6=14\\n2/1*10/100*0=0\\n3-4+5/6+7=8\\n9*9/99/0=0\\n13-2*3-2/'],
680
+ ['simple', '2-3/4=1\\n3-5+6=8\\n4*6/2-9=3\\n7-6/3*4=1\\n5+10-15*2/3=0\\n8/4+5*6-1+'],
681
+ ['simple', '3+4=7\\n2-5=3\\n3/6=1\\n4*9=36\\n10-5=5\\n3-8=5\\n17-10=7\\n23/3=7\\n4+2*6=16'],
682
+ ['simple', '3/2*4+5=7\\n4/2*3-1=4\\n5-4*2*3=13\\n4*4+4-8*2*3=12\\n3/2*4+5-6*4=9\\n5'],
683
+ ['simple', '5+3/6-2*4=7\\n10*1+8/9-2*8=0\\n3*6/2+2-6=7\\n2*3/6-1*7=1\\n5*4-6*2+7-'],
684
+ ['simple', '1+2=3\\n10-4*5/2=0\\n15+17*11+4/14=194\\n5*6+2/8+9=44\\n16*12/8+7-3*11='],
685
+ ['simple', '2-3+4*5/6=1\\n3-0=3\\n4-3+5*6/7=5\\n8-9+10*11/12=15\\n13-14+15*16/17=43\\n19-'],
686
+ ['simple', '2+3*4-5/6=19\\n3+4*5-6/7=29\\n4+5*6-7/8=32\\n5+6*7-8/9=39\\n6+7*8-9/10=41\\n7'],
687
+ ['simple', '1+2=3\\n2/4=2\\n1+2*3=9\\n3/3=1\\n5-2=3\\n8+6-4=10\\n7+5-3=9\\n15-5+2=12\\n16-4+8=20'],
688
+ ['simple',
689
+ '1+2=3\\n2/4=2\\n1+2*3=9\\n3/5=0\\n4-6=2\\n7-8=1\\n10-11=1\\n12-13=1\\n14-15=1\\n16-17=1'],
690
+ ['simple',
691
+ '1+2=3\\n2/4=2\\n1+2*3=9\\n3-2*5+6=7\\n8-16/4+4=0\\n10+20-30/40-50=0\\n12-18+24/36-42/54'],
692
+ ['simple',
693
+ '1+2=3\\n2/4=2\\n1+2*3=9\\n3-5+7-8+6-9+10-11-12+13-14-15+16-17-18-19+20-21-22-23-24-25-'],
694
+ ['simple',
695
+ '1+2=3\\n4/4=2\\n1+2*3=9\\n5+6-7+8-9+10-11+12-13+14-15+16-17+18-19+20-21+22-23+24-25-26+']]
696
+
697
+
698
+ @pytest.mark.parametrize(('name', 'test_case'), CASES)
699
+ def test_it_parses_a_known_valid_grammar(name, test_case):
700
+ test_case = unescape(test_case)
701
+
702
+ state = GBNF(unescape(GRAMMARS[name]))
703
+
704
+ for char in test_case:
705
+ state = state.add(char)
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_iteration.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from gbnf import GBNF
4
+
5
+ CASES = [['root ::= "foo"', [{'type': 'char', 'value': [102]}]],
6
+ ['root ::= "foo" | "bar" ', [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
7
+ ['root ::= "foo" | "bar" | "gaz"',
8
+ [{'type': 'char', 'value': [102]},
9
+ {'type': 'char', 'value': [98]},
10
+ {'type': 'char', 'value': [103]}]],
11
+ ['root ::= "foo" | "bar" | "baz"',
12
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
13
+ ['root ::= [^x]', [{'type': 'char_exclude', 'value': [120]}]],
14
+ ['root ::= [^f] "o"', [{'type': 'char_exclude', 'value': [102]}]],
15
+ ['root ::= [^A-Z]', [{'type': 'char_exclude', 'value': [[65, 90]]}]],
16
+ ['root ::= [^A-Z0-9]', [{'type': 'char_exclude', 'value': [[65, 90], [48, 57]]}]],
17
+ ['root ::= [^A-Z0-9_-]', [{'type': 'char_exclude', 'value': [[65, 90], [48, 57], 95, 45]}]],
18
+ ['\nroot ::= foo\nfoo ::= "foo"\n ', [{'type': 'char', 'value': [102]}]],
19
+ ['\nroot ::= f\nf ::= foo\nfoo ::= "foo"\n ', [{'type': 'char', 'value': [102]}]],
20
+ ['\nroot ::= foo | "bar"\nfoo ::= "foo"',
21
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
22
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"\n ',
23
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
24
+ ['\n'
25
+ 'root ::= f | b\n'
26
+ 'f ::= fo\n'
27
+ 'b ::= ba\n'
28
+ 'fo ::= foo\n'
29
+ 'ba ::= bar | baz\n'
30
+ 'foo ::= "foo"\n'
31
+ 'bar ::= "bar"\n'
32
+ 'baz ::= "baz"\n'
33
+ ' ',
34
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
35
+ ['root ::= [a-z]', [{'type': 'char', 'value': [[97, 122]]}]],
36
+ ['root ::= [a-zA-Z]', [{'type': 'char', 'value': [[97, 122], [65, 90]]}]],
37
+ ['root ::= [a-z]?', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
38
+ ['root ::= [a-z]+', [{'type': 'char', 'value': [[97, 122]]}]],
39
+ ['root ::= [a-z]*', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
40
+ ['\n root ::= "foo"\n foo ::= "foo"', [{'type': 'char', 'value': [102]}]],
41
+ ['\n root ::= (expr "=" term "\\n")+\n expr ::= term ([-+*/] term)*\n term ::= [0-9]+\n ',
42
+ [{'type': 'char', 'value': [[48, 57]]}]]]
43
+
44
+
45
+ @pytest.mark.parametrize(('grammar', 'expected'), CASES)
46
+ def test_it_returns_parse_state_for_a_grammar(grammar, expected):
47
+ state = GBNF(grammar)
48
+ assert list(state) == expected
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_iteration_with_additional_strings.py ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from gbnf import GBNF, InputParseError
4
+
5
+ THROWS = [['root ::= "foo"', 'f', '1'],
6
+ ['root ::= "foo"', 'f', 'b'],
7
+ ['root ::= "foo"', 'f', 'o1'],
8
+ ['root ::= "foo"', 'f', 'ooo'],
9
+ ['root ::= "foo"', 'f', 'ooooooo'],
10
+ ['root ::= "foo" | "bar"', 'f', '1'],
11
+ ['root ::= "foo" | "bar"', 'b', '1'],
12
+ ['root ::= "foo" | "bar"', 'f', 'o1'],
13
+ ['root ::= "foo" | "bar"', 'b', 'a1'],
14
+ ['root ::= "foo" | "bar"', 'f', 'ooo'],
15
+ ['root ::= "foo" | "bar"', 'b', 'arrr'],
16
+ ['root ::= "foo" | "bar" | "baz"', 'f', '1'],
17
+ ['root ::= "foo" | "bar" | "baz"', 'f', 'z'],
18
+ ['root ::= "foo" | "bar" | "baz"', 'b', 'b1'],
19
+ ['root ::= "foo" | "bar" | "baz"', 'f', 'o1'],
20
+ ['root ::= "foo" | "bar" | "baz"', 'b', 'al'],
21
+ ['root ::= "foo" | "bar" | "baz"', 'f', 'ooo'],
22
+ ['root ::= "foo" | "bar" | "baz"', 'b', 'azrr'],
23
+ ['root ::= foo\nfoo ::="foo"', 'f', '1'],
24
+ ['root ::= foo\nfoo ::="foo"', 'f', 'b'],
25
+ ['root ::= foo\nfoo ::="foo"', 'f', 'o1'],
26
+ ['root ::= foo\nfoo ::="foo"', 'f', 'ooo'],
27
+ ['root::=foo|"bar"\nfoo::="foo"', 'f', '1'],
28
+ ['root::=foo|"bar"\nfoo::="foo"', 'f', 'z'],
29
+ ['root::=foo|"bar"\nfoo::="foo"', 'b', 'b1'],
30
+ ['root::=foo|"bar"\nfoo::="foo"', 'f', 'o1'],
31
+ ['root::=foo|"bar"\nfoo::="foo"', 'f', 'ooo'],
32
+ ['root::=foo|"bar"\nfoo::="foo"', 'b', 'arr'],
33
+ ['root::= foo | bar\n foo::="foo"\n bar::="bar"', 'f', '1'],
34
+ ['root::= foo | bar\n foo::="foo"\n bar::="bar"', 'f', 'z'],
35
+ ['root::= foo | bar\n foo::="foo"\n bar::="bar"', 'b', '1'],
36
+ ['root::= foo | bar\n foo::="foo"\n bar::="bar"', 'f', 'o1'],
37
+ ['root::= foo | bar\n foo::="foo"\n bar::="bar"', 'f', 'ooo'],
38
+ ['root::= foo | bar\n foo::="foo"\n bar::="bar"', 'b', 'arr'],
39
+ ['root ::= f | b\n'
40
+ 'f ::= fo\n'
41
+ 'b ::= ba\n'
42
+ 'fo ::= foo\n'
43
+ 'ba ::= bar | baz\n'
44
+ 'foo ::= "foo"\n'
45
+ 'bar ::= "bar"\n'
46
+ 'baz ::= "baz"',
47
+ 'f',
48
+ '1'],
49
+ ['root ::= f | b\n'
50
+ 'f ::= fo\n'
51
+ 'b ::= ba\n'
52
+ 'fo ::= foo\n'
53
+ 'ba ::= bar | baz\n'
54
+ 'foo ::= "foo"\n'
55
+ 'bar ::= "bar"\n'
56
+ 'baz ::= "baz"',
57
+ 'f',
58
+ 'z'],
59
+ ['root ::= f | b\n'
60
+ 'f ::= fo\n'
61
+ 'b ::= ba\n'
62
+ 'fo ::= foo\n'
63
+ 'ba ::= bar | baz\n'
64
+ 'foo ::= "foo"\n'
65
+ 'bar ::= "bar"\n'
66
+ 'baz ::= "baz"',
67
+ 'b',
68
+ '1'],
69
+ ['root ::= f | b\n'
70
+ 'f ::= fo\n'
71
+ 'b ::= ba\n'
72
+ 'fo ::= foo\n'
73
+ 'ba ::= bar | baz\n'
74
+ 'foo ::= "foo"\n'
75
+ 'bar ::= "bar"\n'
76
+ 'baz ::= "baz"',
77
+ 'f',
78
+ 'o1'],
79
+ ['root ::= f | b\n'
80
+ 'f ::= fo\n'
81
+ 'b ::= ba\n'
82
+ 'fo ::= foo\n'
83
+ 'ba ::= bar | baz\n'
84
+ 'foo ::= "foo"\n'
85
+ 'bar ::= "bar"\n'
86
+ 'baz ::= "baz"',
87
+ 'f',
88
+ 'ooo'],
89
+ ['root ::= f | b\n'
90
+ 'f ::= fo\n'
91
+ 'b ::= ba\n'
92
+ 'fo ::= foo\n'
93
+ 'ba ::= bar | baz\n'
94
+ 'foo ::= "foo"\n'
95
+ 'bar ::= "bar"\n'
96
+ 'baz ::= "baz"',
97
+ 'b',
98
+ 'arr'],
99
+ ['root ::= f | b\n'
100
+ 'f ::= fo\n'
101
+ 'b ::= ba\n'
102
+ 'fo ::= foo\n'
103
+ 'ba ::= bar | baz\n'
104
+ 'foo ::= "foo"\n'
105
+ 'bar ::= "bar"\n'
106
+ 'baz ::= "baz"',
107
+ 'b',
108
+ 'azr'],
109
+ ['root ::= [a-z]', 'a', 'A'],
110
+ ['root ::= [a-z]', 'a', '0'],
111
+ ['root ::= [a-z]', 'a', 'az'],
112
+ ['root ::= [a-z]?', 'a', 'A'],
113
+ ['root ::= [a-z]?', 'a', '0'],
114
+ ['root ::= [a-z]?', 'a', 'az'],
115
+ ['root ::= [a-z]+', 'a', 'A'],
116
+ ['root ::= [a-z]+', 'a', '0'],
117
+ ['root ::= [a-z]+', 'a', 'z0'],
118
+ ['root ::= [a-z]*', 'a', 'A'],
119
+ ['root ::= [a-z]*', 'a', '0'],
120
+ ['root ::= [a-z]*', 'a', 'z0']]
121
+
122
+ PARSES = [['root ::= "foo"', '', 'f', [{'type': 'char', 'value': [111]}]],
123
+ ['root ::= "foo"', 'f', 'o', [{'type': 'char', 'value': [111]}]],
124
+ ['root ::= "foo"', 'fo', 'o', [{'type': 'end'}]],
125
+ ['root ::= "foo" | "bar" ', '', 'f', [{'type': 'char', 'value': [111]}]],
126
+ ['root ::= "foo" | "bar" ', 'f', 'o', [{'type': 'char', 'value': [111]}]],
127
+ ['root ::= "foo" | "bar" ', 'fo', 'o', [{'type': 'end'}]],
128
+ ['root ::= "foo" | "bar" ', '', 'b', [{'type': 'char', 'value': [97]}]],
129
+ ['root ::= "foo" | "bar" ', 'b', 'a', [{'type': 'char', 'value': [114]}]],
130
+ ['root ::= "foo" | "bar" ', 'ba', 'r', [{'type': 'end'}]],
131
+ ['root ::= "foo" | "bar" | "baz"',
132
+ 'b',
133
+ 'a',
134
+ [{'type': 'char', 'value': [114]}, {'type': 'char', 'value': [122]}]],
135
+ ['root ::= [^f] "o"', 'g', 'o', [{'type': 'end'}]],
136
+ ['root ::= [^A-Z]', '', 'a', [{'type': 'end'}]],
137
+ ['root ::= [^A-Z0-9]', '', 'a', [{'type': 'end'}]],
138
+ ['root ::= [^A-Z0-9_-]', '', 'a', [{'type': 'end'}]],
139
+ ['root ::= foo\nfoo ::= "foo"', '', 'f', [{'type': 'char', 'value': [111]}]],
140
+ ['root ::= foo\nfoo ::= "foo"', 'f', 'o', [{'type': 'char', 'value': [111]}]],
141
+ ['root ::= foo\nfoo ::= "foo"', 'fo', 'o', [{'type': 'end'}]],
142
+ ['root ::= foo | "bar"\nfoo ::= "foo"', '', 'f', [{'type': 'char', 'value': [111]}]],
143
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'f', 'o', [{'type': 'char', 'value': [111]}]],
144
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'fo', 'o', [{'type': 'end'}]],
145
+ ['root ::= foo | "bar"\nfoo ::= "foo"', '', 'b', [{'type': 'char', 'value': [97]}]],
146
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'b', 'a', [{'type': 'char', 'value': [114]}]],
147
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'ba', 'r', [{'type': 'end'}]],
148
+ ['root ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', '', 'f', [{'type': 'char', 'value': [111]}]],
149
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"',
150
+ 'f',
151
+ 'o',
152
+ [{'type': 'char', 'value': [111]}]],
153
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'fo', 'o', [{'type': 'end'}]],
154
+ ['root ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', '', 'b', [{'type': 'char', 'value': [97]}]],
155
+ ['root ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'b', 'a', [{'type': 'char', 'value': [114]}]],
156
+ ['root ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'ba', 'r', [{'type': 'end'}]],
157
+ ['\n'
158
+ 'root ::= f | b\n'
159
+ 'f ::= fo\n'
160
+ 'b ::= ba\n'
161
+ 'fo ::= foo\n'
162
+ 'ba ::= bar | baz\n'
163
+ 'foo ::= "foo"\n'
164
+ 'bar ::= "bar"\n'
165
+ 'baz ::= "baz"',
166
+ '',
167
+ 'f',
168
+ [{'type': 'char', 'value': [111]}]],
169
+ ['root ::= f | b\n'
170
+ 'f ::= fo\n'
171
+ 'b ::= ba\n'
172
+ 'fo ::= foo\n'
173
+ 'ba ::= bar | baz\n'
174
+ 'foo ::= "foo"\n'
175
+ 'bar ::= "bar"\n'
176
+ 'baz ::= "baz"',
177
+ 'f',
178
+ 'o',
179
+ [{'type': 'char', 'value': [111]}]],
180
+ ['root ::= f | b\n'
181
+ 'f ::= fo\n'
182
+ 'b ::= ba\n'
183
+ 'fo ::= foo\n'
184
+ 'ba ::= bar | baz\n'
185
+ 'foo ::= "foo"\n'
186
+ 'bar ::= "bar"\n'
187
+ 'baz ::= "baz"',
188
+ 'fo',
189
+ 'o',
190
+ [{'type': 'end'}]],
191
+ ['root ::= f | b\n'
192
+ 'f ::= fo\n'
193
+ 'b ::= ba\n'
194
+ 'fo ::= foo\n'
195
+ 'ba ::= bar | baz\n'
196
+ 'foo ::= "foo"\n'
197
+ 'bar ::= "bar"\n'
198
+ 'baz ::= "baz"',
199
+ '',
200
+ 'b',
201
+ [{'type': 'char', 'value': [97]}]],
202
+ ['\n'
203
+ 'root ::= f | b\n'
204
+ 'f ::= fo\n'
205
+ 'b ::= ba\n'
206
+ 'fo ::= foo\n'
207
+ 'ba ::= bar | baz\n'
208
+ 'foo ::= "foo"\n'
209
+ 'bar ::= "bar"\n'
210
+ 'baz ::= "baz"',
211
+ 'b',
212
+ 'a',
213
+ [{'type': 'char', 'value': [114]}, {'type': 'char', 'value': [122]}]],
214
+ ['\n'
215
+ 'root ::= f | b\n'
216
+ 'f ::= fo\n'
217
+ 'b ::= ba\n'
218
+ 'fo ::= foo\n'
219
+ 'ba ::= bar | baz\n'
220
+ 'foo ::= "foo"\n'
221
+ 'bar ::= "bar"\n'
222
+ 'baz ::= "baz"',
223
+ 'ba',
224
+ 'r',
225
+ [{'type': 'end'}]],
226
+ ['\n'
227
+ 'root ::= f | b\n'
228
+ 'f ::= fo\n'
229
+ 'b ::= ba\n'
230
+ 'fo ::= foo\n'
231
+ 'ba ::= bar | baz\n'
232
+ 'foo ::= "foo"\n'
233
+ 'bar ::= "bar"\n'
234
+ 'baz ::= "baz"',
235
+ 'ba',
236
+ 'z',
237
+ [{'type': 'end'}]],
238
+ ['root ::= [a-z]', '', 'a', [{'type': 'end'}]],
239
+ ['root ::= [a-z]', '', 'm', [{'type': 'end'}]],
240
+ ['root ::= [a-z]', '', 'z', [{'type': 'end'}]],
241
+ ['root ::= [a-zA-Z]', '', 'a', [{'type': 'end'}]],
242
+ ['root ::= [a-zA-Z]', '', 'Z', [{'type': 'end'}]],
243
+ ['root ::= [a-zA-Z0-9]', '', 'Z', [{'type': 'end'}]],
244
+ ['root ::= [a-zA-Z0-9]', '', '0', [{'type': 'end'}]],
245
+ ['root ::= [a-zA-Z0-9]', '', '9', [{'type': 'end'}]],
246
+ ['root ::= [a-z]?', '', 'a', [{'type': 'end'}]],
247
+ ['root ::= [a-zA-Z]?', '', 'Z', [{'type': 'end'}]],
248
+ ['root ::= [a-zA-Z0-9]?', '', '0', [{'type': 'end'}]],
249
+ ['root ::= [a-z]+', '', 'a', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
250
+ ['root ::= [a-zA-Z]+',
251
+ '',
252
+ 'Z',
253
+ [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
254
+ ['root ::= [a-zA-Z]+',
255
+ 'azA',
256
+ 'Z',
257
+ [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
258
+ ['root ::= [a-z]*', '', 'a', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
259
+ ['root ::= [a-zA-Z]+',
260
+ '',
261
+ 'Z',
262
+ [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
263
+ ['root ::= [a-zA-Z]+',
264
+ 'acczABC',
265
+ 'Z',
266
+ [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
267
+ ['root ::= "foo" | "bar" | "baz" | "bazaar" | "barrington" ',
268
+ 'baza',
269
+ 'a',
270
+ [{'type': 'char', 'value': [114]}]],
271
+ ['root ::= [^f]+ "o"',
272
+ 'aaa',
273
+ 'a',
274
+ [{'type': 'char_exclude', 'value': [102]}, {'type': 'char', 'value': [111]}]],
275
+ ['root ::= [^A-Z]+', 'abc', 'd', [{'type': 'char_exclude', 'value': [[65, 90]]}, {'type': 'end'}]],
276
+ ['root ::= [^A-Z0-9]*',
277
+ 'abc',
278
+ 'd',
279
+ [{'type': 'char_exclude', 'value': [[65, 90], [48, 57]]}, {'type': 'end'}]],
280
+ ['root ::= [^A-Z0-9_-]*',
281
+ 'abc',
282
+ 'd',
283
+ [{'type': 'char_exclude', 'value': [[65, 90], [48, 57], 95, 45]}, {'type': 'end'}]]]
284
+
285
+
286
+ @pytest.mark.parametrize(('grammar', 'starting', 'additional'), THROWS)
287
+ def test_it_throws_if_encountering_a_grammar_with_starting_and_additional(grammar, starting, additional):
288
+ graph = GBNF(grammar, starting)
289
+ with pytest.raises(Exception):
290
+ graph.add(additional)
291
+
292
+
293
+ @pytest.mark.parametrize(('grammar', 'starting', 'additional', 'expected'), PARSES)
294
+ def test_it_parses_a_grammar_with_starting_and_additional(grammar, starting, additional, expected):
295
+ state = GBNF(grammar, starting)
296
+ state = state.add(additional)
297
+ assert list(state) == expected
298
+
299
+
300
+ @pytest.mark.parametrize('error_for_most_recent_input', [False, True])
301
+ def test_it_throws_a_particular_error(error_for_most_recent_input):
302
+ grammar = 'root ::= "bar"'
303
+ state = GBNF(grammar)
304
+ state = state.add('b')
305
+ state = state.add('a')
306
+ with pytest.raises(InputParseError) as exc_info:
307
+ state.add('z')
308
+ err = exc_info.value
309
+ expected_err = InputParseError('z', 0, 'ba')
310
+ if error_for_most_recent_input:
311
+ assert err.error_for_most_recent_input == expected_err.error_for_most_recent_input
312
+ else:
313
+ assert str(err) == str(expected_err)
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/iteration/test_iteration_with_an_initial_string.py ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from gbnf import GBNF
4
+
5
+ CASES = [['root ::= "foo"', '', [{'type': 'char', 'value': [102]}]],
6
+ ['root ::= "foo"', 'f', [{'type': 'char', 'value': [111]}]],
7
+ ['root ::= "foo"', 'fo', [{'type': 'char', 'value': [111]}]],
8
+ ['root ::= "foo"', 'foo', [{'type': 'end'}]],
9
+ ['root ::= "foo" | "bar" ',
10
+ '',
11
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
12
+ ['root ::= "foo" | "bar" ', 'f', [{'type': 'char', 'value': [111]}]],
13
+ ['root ::= "foo" | "bar" ', 'fo', [{'type': 'char', 'value': [111]}]],
14
+ ['root ::= "foo" | "bar" ', 'foo', [{'type': 'end'}]],
15
+ ['root ::= "foo" | "bar" ', 'b', [{'type': 'char', 'value': [97]}]],
16
+ ['root ::= "foo" | "bar" ', 'ba', [{'type': 'char', 'value': [114]}]],
17
+ ['root ::= "foo" | "bar" ', 'bar', [{'type': 'end'}]],
18
+ ['root ::= "foo" | "bar" | "baz"',
19
+ 'ba',
20
+ [{'type': 'char', 'value': [114]}, {'type': 'char', 'value': [122]}]],
21
+ ['root ::= "["', '[', [{'type': 'end'}]],
22
+ ['root ::= "]"', ']', [{'type': 'end'}]],
23
+ ['root ::= "[]"', '[]', [{'type': 'end'}]],
24
+ ['root ::= "{"', '{', [{'type': 'end'}]],
25
+ ['root ::= "}"', '}', [{'type': 'end'}]],
26
+ ['root ::= "{}"', '{}', [{'type': 'end'}]],
27
+ ['root ::= "[{}]"', '[{}]', [{'type': 'end'}]],
28
+ ['root ::= [^f] "o"', '', [{'type': 'char_exclude', 'value': [102]}]],
29
+ ['root ::= [^f] "o"', 'a', [{'type': 'char', 'value': [111]}]],
30
+ ['root ::= [^A-Z]', '', [{'type': 'char_exclude', 'value': [[65, 90]]}]],
31
+ ['root ::= [^A-Z0-9]', '', [{'type': 'char_exclude', 'value': [[65, 90], [48, 57]]}]],
32
+ ['root ::= [^A-Z0-9_-]', '', [{'type': 'char_exclude', 'value': [[65, 90], [48, 57], 95, 45]}]],
33
+ ['\nroot ::= foo\nfoo ::= "foo"', '', [{'type': 'char', 'value': [102]}]],
34
+ ['root ::= foo\nfoo ::= "foo"\n', 'f', [{'type': 'char', 'value': [111]}]],
35
+ ['\nroot ::= foo\nfoo ::= "foo"\n', 'fo', [{'type': 'char', 'value': [111]}]],
36
+ ['root ::= foo\nfoo ::= "foo"', 'foo', [{'type': 'end'}]],
37
+ ['root ::= f\nf ::= foo\nfoo ::= "foo"', '', [{'type': 'char', 'value': [102]}]],
38
+ ['\nroot ::= foo | "bar"\nfoo ::= "foo"\n',
39
+ '',
40
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
41
+ ['\nroot ::= foo | "bar"\nfoo ::= "foo"', 'f', [{'type': 'char', 'value': [111]}]],
42
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'fo', [{'type': 'char', 'value': [111]}]],
43
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'foo', [{'type': 'end'}]],
44
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'b', [{'type': 'char', 'value': [97]}]],
45
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'ba', [{'type': 'char', 'value': [114]}]],
46
+ ['root ::= foo | "bar"\nfoo ::= "foo"', 'bar', [{'type': 'end'}]],
47
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"',
48
+ '',
49
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
50
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'f', [{'type': 'char', 'value': [111]}]],
51
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'fo', [{'type': 'char', 'value': [111]}]],
52
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'foo', [{'type': 'end'}]],
53
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'b', [{'type': 'char', 'value': [97]}]],
54
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'ba', [{'type': 'char', 'value': [114]}]],
55
+ ['\nroot ::= foo | bar\nfoo ::= "foo"\nbar ::= "bar"', 'bar', [{'type': 'end'}]],
56
+ ['\n'
57
+ 'root ::= f | b\n'
58
+ 'f ::= fo\n'
59
+ 'b ::= ba\n'
60
+ 'fo ::= foo\n'
61
+ 'ba ::= bar | baz\n'
62
+ 'foo ::= "foo"\n'
63
+ 'bar ::= "bar"\n'
64
+ 'baz ::= "baz"',
65
+ '',
66
+ [{'type': 'char', 'value': [102]}, {'type': 'char', 'value': [98]}]],
67
+ ['\n'
68
+ 'root ::= f | b\n'
69
+ 'f ::= fo\n'
70
+ 'b ::= ba\n'
71
+ 'fo ::= foo\n'
72
+ 'ba ::= bar | baz\n'
73
+ 'foo ::= "foo"\n'
74
+ 'bar ::= "bar"\n'
75
+ 'baz ::= "baz"',
76
+ 'f',
77
+ [{'type': 'char', 'value': [111]}]],
78
+ ['\n'
79
+ 'root ::= f | b\n'
80
+ 'f ::= fo\n'
81
+ 'b ::= ba\n'
82
+ 'fo ::= foo\n'
83
+ 'ba ::= bar | baz\n'
84
+ 'foo ::= "foo"\n'
85
+ 'bar ::= "bar"\n'
86
+ 'baz ::= "baz"',
87
+ 'fo',
88
+ [{'type': 'char', 'value': [111]}]],
89
+ ['\n'
90
+ 'root ::= f | b\n'
91
+ 'f ::= fo\n'
92
+ 'b ::= ba\n'
93
+ 'fo ::= foo\n'
94
+ 'ba ::= bar | baz\n'
95
+ 'foo ::= "foo"\n'
96
+ 'bar ::= "bar"\n'
97
+ 'baz ::= "baz"',
98
+ 'foo',
99
+ [{'type': 'end'}]],
100
+ ['\n'
101
+ 'root ::= f | b\n'
102
+ 'f ::= fo\n'
103
+ 'b ::= ba\n'
104
+ 'fo ::= foo\n'
105
+ 'ba ::= bar | baz\n'
106
+ 'foo ::= "foo"\n'
107
+ 'bar ::= "bar"\n'
108
+ 'baz ::= "baz"',
109
+ 'b',
110
+ [{'type': 'char', 'value': [97]}]],
111
+ ['\n'
112
+ 'root ::= f | b\n'
113
+ 'f ::= fo\n'
114
+ 'b ::= ba\n'
115
+ 'fo ::= foo\n'
116
+ 'ba ::= bar | baz\n'
117
+ 'foo ::= "foo"\n'
118
+ 'bar ::= "bar"\n'
119
+ 'baz ::= "baz"',
120
+ 'ba',
121
+ [{'type': 'char', 'value': [114]}, {'type': 'char', 'value': [122]}]],
122
+ ['\n'
123
+ 'root ::= f | b\n'
124
+ 'f ::= fo\n'
125
+ 'b ::= ba\n'
126
+ 'fo ::= foo\n'
127
+ 'ba ::= bar | baz\n'
128
+ 'foo ::= "foo"\n'
129
+ 'bar ::= "bar"\n'
130
+ 'baz ::= "baz"',
131
+ 'bar',
132
+ [{'type': 'end'}]],
133
+ ['\n'
134
+ 'root ::= f | b\n'
135
+ 'f ::= fo\n'
136
+ 'b ::= ba\n'
137
+ 'fo ::= foo\n'
138
+ 'ba ::= bar | baz\n'
139
+ 'foo ::= "foo"\n'
140
+ 'bar ::= "bar"\n'
141
+ 'baz ::= "baz"',
142
+ 'baz',
143
+ [{'type': 'end'}]],
144
+ ['root ::= [a-z]', '', [{'type': 'char', 'value': [[97, 122]]}]],
145
+ ['root ::= [a-zA-Z]', '', [{'type': 'char', 'value': [[97, 122], [65, 90]]}]],
146
+ ['root ::= [a-z]', 'a', [{'type': 'end'}]],
147
+ ['root ::= [a-z]', 'm', [{'type': 'end'}]],
148
+ ['root ::= [a-z]', 'z', [{'type': 'end'}]],
149
+ ['root ::= [a-zA-Z]', 'a', [{'type': 'end'}]],
150
+ ['root ::= [a-zA-Z]', 'Z', [{'type': 'end'}]],
151
+ ['root ::= [a-zA-Z0-9]', 'Z', [{'type': 'end'}]],
152
+ ['root ::= [a-zA-Z0-9]', '0', [{'type': 'end'}]],
153
+ ['root ::= [a-zA-Z0-9]', '9', [{'type': 'end'}]],
154
+ ['root ::= [a-z]?', '', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
155
+ ['root ::= [a-z]?', 'a', [{'type': 'end'}]],
156
+ ['root ::= [a-zA-Z]?', 'Z', [{'type': 'end'}]],
157
+ ['root ::= [a-zA-Z0-9]?', '0', [{'type': 'end'}]],
158
+ ['root ::= [a-z]+', '', [{'type': 'char', 'value': [[97, 122]]}]],
159
+ ['root ::= [a-z]+', 'l', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
160
+ ['root ::= [a-zA-Z]+', 'Z', [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
161
+ ['root ::= [a-zA-Z]+', 'aZ', [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
162
+ ['root ::= [a-zA-Z]+',
163
+ 'azAZ',
164
+ [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
165
+ ['root ::= [a-z]*', '', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
166
+ ['root ::= [a-z]*', 'a', [{'type': 'char', 'value': [[97, 122]]}, {'type': 'end'}]],
167
+ ['root ::= [a-zA-Z]+', 'Z', [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
168
+ ['root ::= [a-zA-Z]+',
169
+ 'abczABCZ',
170
+ [{'type': 'char', 'value': [[97, 122], [65, 90]]}, {'type': 'end'}]],
171
+ ['root ::= [^f]+ "o"',
172
+ 'aaa',
173
+ [{'type': 'char_exclude', 'value': [102]}, {'type': 'char', 'value': [111]}]],
174
+ ['root ::= [^A-Z]+', 'abc', [{'type': 'char_exclude', 'value': [[65, 90]]}, {'type': 'end'}]],
175
+ ['root ::= [^A-Z0-9]*',
176
+ 'abc',
177
+ [{'type': 'char_exclude', 'value': [[65, 90], [48, 57]]}, {'type': 'end'}]],
178
+ ['root ::= [^A-Z0-9_-]*',
179
+ 'abc',
180
+ [{'type': 'char_exclude', 'value': [[65, 90], [48, 57], 95, 45]}, {'type': 'end'}]],
181
+ ['\nroot ::= [a-z] | xyx\nxyx ::= "foo"',
182
+ 'f',
183
+ [{'type': 'end'}, {'type': 'char', 'value': [111]}]],
184
+ ['root ::= "foo" | "bar" | "baz" | "bazaar" | "barrington" ',
185
+ 'bazaa',
186
+ [{'type': 'char', 'value': [114]}]],
187
+ ['root ::= ("bar" | "foo") "zyx"', 'bar', [{'type': 'char', 'value': [122]}]],
188
+ ['root ::= "z" ("bar" | "foo") "zzzz"',
189
+ 'z',
190
+ [{'type': 'char', 'value': [98]}, {'type': 'char', 'value': [102]}]],
191
+ ['root ::= "z" ("bar" | "foo") "zzz"', 'zbar', [{'type': 'char', 'value': [122]}]],
192
+ ['\nroot ::= termz ([-+*/] termz)* \ntermz ::= [0-9]+',
193
+ '1',
194
+ [{'type': 'char', 'value': [[48, 57]]},
195
+ {'type': 'char', 'value': [45, 43, 42, 47]},
196
+ {'type': 'end'}]],
197
+ ['\nroot ::= expr "=" termy \nexpr ::= termy ([-+*/] termy)*\ntermy ::= [0-9]+',
198
+ '1',
199
+ [{'type': 'char', 'value': [[48, 57]]},
200
+ {'type': 'char', 'value': [45, 43, 42, 47]},
201
+ {'type': 'char', 'value': [61]}]],
202
+ ['\nroot ::= (expr "=" terma "\n")+\nexpr ::= terma ([-+*/] terma)*\nterma ::= [0-9]+',
203
+ '1',
204
+ [{'type': 'char', 'value': [[48, 57]]},
205
+ {'type': 'char', 'value': [45, 43, 42, 47]},
206
+ {'type': 'char', 'value': [61]}]],
207
+ ['root ::= (expr "=" termb "\n")+\nexpr ::= termb ([-+*/] termb)*\ntermb ::= [0-9]+',
208
+ '1+',
209
+ [{'type': 'char', 'value': [[48, 57]]}]],
210
+ ['\nroot ::= (expr "=" termc "\n")+\nexpr ::= termc ([-+*/] termc)*\ntermc ::= [0-9]+',
211
+ '1=',
212
+ [{'type': 'char', 'value': [[48, 57]]}]],
213
+ ['root ::= (expr "=" termd "\n")+\nexpr ::= termd ([-+*/] termd)*\ntermd ::= [0-9]+',
214
+ '1+1',
215
+ [{'type': 'char', 'value': [[48, 57]]},
216
+ {'type': 'char', 'value': [45, 43, 42, 47]},
217
+ {'type': 'char', 'value': [61]}]],
218
+ ['root ::= (expr "=" term "\n")+\nexpr ::= term ([-+*/] term)*\nterm ::= [0-9]+',
219
+ '1=1',
220
+ [{'type': 'char', 'value': [[48, 57]]}, {'type': 'char', 'value': [10]}]],
221
+ ['root ::= "\\"" ( [^\\"abcdefghA-Z])* ',
222
+ '"is not only in its lyrism, its vow to sustin it in its poo-sion, its r,v:l\'y, it\'s tory,',
223
+ [{'type': 'char_exclude', 'value': [34, 97, 98, 99, 100, 101, 102, 103, 104, [65, 90]]},
224
+ {'type': 'end'}]],
225
+ ['root ::= ( [^abcdefgh] | [b-z])* ',
226
+ 'bcdefghzyxw0123ABCZ',
227
+ [{'type': 'char_exclude', 'value': [97, 98, 99, 100, 101, 102, 103, 104]},
228
+ {'type': 'char', 'value': [[98, 122]]},
229
+ {'type': 'end'}]]]
230
+
231
+
232
+ @pytest.mark.parametrize(('grammar', 'initial_string', 'expected'), CASES)
233
+ def test_it_returns_parse_state_for_a_grammar_and_initial_string(grammar, initial_string, expected):
234
+ state = GBNF(grammar, initial_string)
235
+ assert list(state) == expected
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__init__.py ADDED
File without changes
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (157 Bytes). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__pycache__/test_validate_grammar.cpython-314-pytest-9.1.1.pyc ADDED
Binary file (5.37 kB). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/__pycache__/test_validate_input.cpython-314-pytest-9.1.1.pyc ADDED
Binary file (6.97 kB). View file
 
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/test_validate_grammar.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from gbnf import GBNF, GrammarParseError
4
+
5
+ VALID = ['root ::= "foo"',
6
+ 'root ::= "foo" | "bar"',
7
+ 'root ::= ("foo" | "bar")',
8
+ 'root ::= ("foo" | "bar")?',
9
+ 'root ::= ("foo" | "bar")*',
10
+ 'root ::= ("foo" | "bar")+',
11
+ 'root ::= [a-z]',
12
+ 'root ::= [a-zA-Z]',
13
+ 'root ::= [a-zA-Z0-9]',
14
+ 'root ::= [a-zA-Z0-9]*',
15
+ 'root ::= [a-zA-Z0-9]?',
16
+ 'root ::= [a-z]+',
17
+ 'root ::= [a-zA-Z0-9]+',
18
+ 'root ::= ([a-zA-Z0-9])*',
19
+ 'root ::= ([a-zA-Z0-9])?',
20
+ 'root ::= ([a-zA-Z0-9])+',
21
+ '\n root ::= foo\n foo ::= "foo"',
22
+ '\n root ::= foo\n foo ::= "foo" | "bar" | ([a-z])?\n ']
23
+
24
+ INVALID = [['', 0, 'No rules were found'],
25
+ ['root = "foo"', 5, 'Expecting ::= at 5'],
26
+ ['root ::= foo\nfoo := "foo"\n ', 17, 'Expecting ::= at 17'],
27
+ ['root ::= foo', 9, 'Undefined rule identifier "foo"'],
28
+ ['root ::= foo\nbar ::= "bar"\n ', 9, 'Undefined rule identifier "foo"'],
29
+ ['root ::= foo\nfoo ::= baz\nbar ::= "bar"\n ', 21, 'Undefined rule identifier "baz"'],
30
+ ['root ::= foo ::= bar', 13, 'Expecting newline or end at 13'],
31
+ ['root ::= ([a-z]\nfoo ::= "foo"\n ', 20, "Expecting ')' at 20"]]
32
+
33
+
34
+ @pytest.mark.parametrize('grammar', VALID)
35
+ def test_it_parses_a_grammar(grammar):
36
+ assert GBNF(grammar)
37
+
38
+
39
+ @pytest.mark.parametrize(('grammar', 'error_pos', 'error_reason'), INVALID)
40
+ def test_it_reports_an_error_for_an_invalid_grammar(grammar, error_pos, error_reason):
41
+ with pytest.raises(GrammarParseError) as exc_info:
42
+ GBNF(grammar)
43
+ assert str(exc_info.value) == str(GrammarParseError(grammar, error_pos, error_reason))
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/integration_tests/generated/validation/test_validate_input.py ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from gbnf import GBNF, InputParseError
4
+
5
+ VALID = [['root ::= "foo"', 'f']]
6
+
7
+ INVALID = [['root ::= "foo"', '2', 0],
8
+ ['root ::= "foo"', 'b', 0],
9
+ ['root ::= "foo"', 'f1', 1],
10
+ ['root ::= "foo"', 'fo1', 2],
11
+ ['root ::= "foo"', 'fooo', 3],
12
+ ['root ::= "foo"', 'fooooooo', 3],
13
+ ['root ::= "foo" | "bar"', '1', 0],
14
+ ['root ::= "foo" | "bar"', 'z', 0],
15
+ ['root ::= "foo" | "bar"', 'f1', 1],
16
+ ['root ::= "foo" | "bar"', 'b1', 1],
17
+ ['root ::= "foo" | "bar"', 'fo1', 2],
18
+ ['root ::= "foo" | "bar"', 'ba1', 2],
19
+ ['root ::= "foo" | "bar"', 'fooo', 3],
20
+ ['root ::= "foo" | "bar"', 'barrr', 3],
21
+ ['root ::= "foo" | "bar" | "baz"', '1', 0],
22
+ ['root ::= "foo" | "bar" | "baz"', 'z', 0],
23
+ ['root ::= "foo" | "bar" | "baz"', 'f1', 1],
24
+ ['root ::= "foo" | "bar" | "baz"', 'b1', 1],
25
+ ['root ::= "foo" | "bar" | "baz"', 'fo1', 2],
26
+ ['root ::= "foo" | "bar" | "baz"', 'bal', 2],
27
+ ['root ::= "foo" | "bar" | "baz"', 'fooo', 3],
28
+ ['root ::= "foo" | "bar" | "baz"', 'bazrr', 3],
29
+ ['root ::= [^a]', 'a', 0],
30
+ ['root ::= [^abc]', 'b', 0],
31
+ ['root ::= [^a-z]', 'z', 0],
32
+ ['root ::= [^a-zA-Z]', 'X', 0],
33
+ ['root ::= [^a-zA-Z0-9]', '8', 0],
34
+ ['\n root ::= foo\n foo ::= "foo"', '1', 0],
35
+ ['\n root ::= foo\n foo ::= "foo"', 'b', 0],
36
+ ['\n root ::= foo\n foo ::= "foo"', 'f1', 1],
37
+ ['\n root ::= foo\n foo ::= "foo"', 'fo1', 2],
38
+ ['\n root ::= foo\n foo ::= "foo"', 'fooo', 3],
39
+ ['\n root::=foo|"bar"\n foo::="foo"', '1', 0],
40
+ ['\n root::=foo|"bar"\n foo::="foo"', 'z', 0],
41
+ ['\n root::=foo|"bar"\n foo::="foo"', 'f1', 1],
42
+ ['\n root::=foo|"bar"\n foo::="foo"', 'b1', 1],
43
+ ['\n root::=foo|"bar"\n foo::="foo"', 'fo1', 2],
44
+ ['\n root::=foo|"bar"\n foo::="foo"', 'fooo', 3],
45
+ ['\n root::=foo|"bar"\n foo::="foo"', 'barr', 3],
46
+ ['\n root::= foo | bar\n foo::="foo"\n bar::="bar"', '1', 0],
47
+ ['\n root::= foo | bar\n foo::="foo"\n bar::="bar"', 'z', 0],
48
+ ['\n root::= foo | bar\n foo::="foo"\n bar::="bar"', 'f1', 1],
49
+ ['\n root::= foo | bar\n foo::="foo"\n bar::="bar"', 'b1', 1],
50
+ ['\n root::= foo | bar\n foo::="foo"\n bar::="bar"', 'fo1', 2],
51
+ ['\n root::= foo | bar\n foo::="foo"\n bar::="bar"', 'fooo', 3],
52
+ ['\n root::= foo | bar\n foo::="foo"\n bar::="bar"', 'barr', 3],
53
+ ['\n'
54
+ ' root ::= f | b\n'
55
+ ' f ::= fo\n'
56
+ ' b ::= ba\n'
57
+ ' fo ::= foo\n'
58
+ ' ba ::= bar | baz\n'
59
+ ' foo ::= "foo"\n'
60
+ ' bar ::= "bar"\n'
61
+ ' baz ::= "baz"\n'
62
+ ' ',
63
+ '1',
64
+ 0],
65
+ ['\n'
66
+ ' root ::= f | b\n'
67
+ ' f ::= fo\n'
68
+ ' b ::= ba\n'
69
+ ' fo ::= foo\n'
70
+ ' ba ::= bar | baz\n'
71
+ ' foo ::= "foo"\n'
72
+ ' bar ::= "bar"\n'
73
+ ' baz ::= "baz"',
74
+ 'z',
75
+ 0],
76
+ ['\n'
77
+ ' root ::= f | b\n'
78
+ ' f ::= fo\n'
79
+ ' b ::= ba\n'
80
+ ' fo ::= foo\n'
81
+ ' ba ::= bar | baz\n'
82
+ ' foo ::= "foo"\n'
83
+ ' bar ::= "bar"\n'
84
+ ' baz ::= "baz"',
85
+ 'f1',
86
+ 1],
87
+ ['\n'
88
+ ' root ::= f | b\n'
89
+ ' f ::= fo\n'
90
+ ' b ::= ba\n'
91
+ ' fo ::= foo\n'
92
+ ' ba ::= bar | baz\n'
93
+ ' foo ::= "foo"\n'
94
+ ' bar ::= "bar"\n'
95
+ ' baz ::= "baz"',
96
+ 'b1',
97
+ 1],
98
+ ['\n'
99
+ ' root ::= f | b\n'
100
+ ' f ::= fo\n'
101
+ ' b ::= ba\n'
102
+ ' fo ::= foo\n'
103
+ ' ba ::= bar | baz\n'
104
+ ' foo ::= "foo"\n'
105
+ ' bar ::= "bar"\n'
106
+ ' baz ::= "baz"',
107
+ 'fo1',
108
+ 2],
109
+ ['\n'
110
+ ' root ::= f | b\n'
111
+ ' f ::= fo\n'
112
+ ' b ::= ba\n'
113
+ ' fo ::= foo\n'
114
+ ' ba ::= bar | baz\n'
115
+ ' foo ::= "foo"\n'
116
+ ' bar ::= "bar"\n'
117
+ ' baz ::= "baz"',
118
+ 'fooo',
119
+ 3],
120
+ ['\n'
121
+ ' root ::= f | b\n'
122
+ ' f ::= fo\n'
123
+ ' b ::= ba\n'
124
+ ' fo ::= foo\n'
125
+ ' ba ::= bar | baz\n'
126
+ ' foo ::= "foo"\n'
127
+ ' bar ::= "bar"\n'
128
+ ' baz ::= "baz"',
129
+ 'barr',
130
+ 3],
131
+ ['\n'
132
+ ' root ::= f | b\n'
133
+ ' f ::= fo\n'
134
+ ' b ::= ba\n'
135
+ ' fo ::= foo\n'
136
+ ' ba ::= bar | baz\n'
137
+ ' foo ::= "foo"\n'
138
+ ' bar ::= "bar"\n'
139
+ ' baz ::= "baz"',
140
+ 'bazr',
141
+ 3],
142
+ ['root ::= [a-z]', 'A', 0],
143
+ ['root ::= [a-z]', '0', 0],
144
+ ['root ::= [a-z]', 'az', 1],
145
+ ['root ::= [a-z]?', 'A', 0],
146
+ ['root ::= [a-z]?', '0', 0],
147
+ ['root ::= [a-z]?', 'az', 1],
148
+ ['root ::= [a-z]+', 'A', 0],
149
+ ['root ::= [a-z]+', '0', 0],
150
+ ['root ::= [a-z]+', 'az0', 2],
151
+ ['root ::= [a-z]*', 'A', 0],
152
+ ['root ::= [a-z]*', '0', 0],
153
+ ['root ::= [a-z]*', 'az0', 2],
154
+ ['root ::= ( [^abcdefgh] | [b-z])*', 'a', 0]]
155
+
156
+
157
+ @pytest.mark.parametrize(('grammar', 'input'), VALID)
158
+ def test_it_parses_a_grammar_and_input(grammar, input):
159
+ assert GBNF(grammar, input)
160
+
161
+
162
+ @pytest.mark.parametrize(('grammar', 'input', 'error_pos'), INVALID)
163
+ def test_it_reports_an_error_for_an_invalid_input(grammar, input, error_pos):
164
+ error = InputParseError(input, error_pos, '')
165
+ graph = GBNF(grammar)
166
+ with pytest.raises(InputParseError) as exc_info:
167
+ graph.add(input)
168
+ assert str(exc_info.value) == str(error)
v2-models-effort/runs/20261028-095511-delicate-sound/ported_implementation/pyproject.toml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "gbnf"
7
+ version = "0.1.41"
8
+ description = "A library for parsing GBNF grammars"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.11"
12
+ authors = [{ name = "Ambient Labs" }]
13
+ keywords = ["gbnf", "grammar", "grammar-parser"]
14
+
15
+ [tool.setuptools.packages.find]
16
+ include = ["gbnf*"]
17
+
18
+ [tool.pytest.ini_options]
19
+ pythonpath = ["."]
20
+ testpaths = ["gbnf", "integration_tests"]
21
+ python_files = ["test_*.py", "*_test.py"]
v2-models-effort/runs/20261028-095511-delicate-sound/proxy.log ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NOTICE Oct 28 15:58:54.042 [8]: Initializing tinyproxy ...
2
+ NOTICE Oct 28 15:58:54.042 [8]: Reloading config file (/etc/tinyproxy/tinyproxy.conf)
3
+ INFO Oct 28 15:58:54.042 [8]: Added address [127.0.0.1] to listen addresses.
4
+ INFO Oct 28 15:58:54.042 [8]: Adding Port [443] to the list allowed by CONNECT
5
+ NOTICE Oct 28 15:58:54.042 [8]: Reloading config file finished
6
+ INFO Oct 28 15:58:54.042 [8]: listen_sock called with addr = '127.0.0.1'
7
+ INFO Oct 28 15:58:54.042 [8]: trying to listen on host[127.0.0.1], family[2], socktype[1], proto[6]
8
+ INFO Oct 28 15:58:54.042 [8]: listening on fd [3]
9
+ INFO Oct 28 15:58:54.042 [8]: Not running as root, so not changing UID/GID.
10
+ INFO Oct 28 15:58:54.042 [8]: Setting the various signals.
11
+ INFO Oct 28 15:58:54.042 [8]: Starting main loop. Accepting connections.
12
+ botbox-proxy: listening
13
+ CONNECT Oct 28 15:58:54.874 [8]: Connect (file descriptor 4): 127.0.0.1
14
+ CONNECT Oct 28 15:58:54.874 [8]: Request (file descriptor 4): CONNECT api.anthropic.com:443 HTTP/1.1
15
+ NOTICE Oct 28 15:58:54.874 [8]: Proxying refused on filtered url "api.anthropic.com:443"
v2-models-effort/runs/20261028-095511-delicate-sound/run.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "params": {
3
+ "source-language": "javascript",
4
+ "model": "claude-sonnet-5-5",
5
+ "effort": "xhigh"
6
+ },
7
+ "command": "uv run --project packages/gbnf_experiment run_gbnf_experiment --include-unit-tests 1 --include-source-integration-tests 1 --include-target-integration-tests 0 --output /home/duncan/work/code/research/ports/experiments/v2-models-effort/runs/20261028-095511-delicate-sound --source-language javascript --model claude-sonnet-5-5 --effort xhigh --auth subscription --memory 24g",
8
+ "created": "2026-10-28T15:58:42Z",
9
+ "ended": "2026-10-28T16:13:55Z",
10
+ "exit_code": 1,
11
+ "error": null,
12
+ "ended_by": null,
13
+ "signal": null,
14
+ "args": [
15
+ "--auth",
16
+ "subscription",
17
+ "--memory",
18
+ "24g"
19
+ ],
20
+ "pid": 4143932,
21
+ "pid_created": 1793203122.38
22
+ }
v2-models-effort/runs/20261028-095511-delicate-sound/stderr.log ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Traceback (most recent call last):
2
+ File "/home/duncan/work/code/research/ports/packages/gbnf_experiment/.venv/bin/run_gbnf_experiment", line 10, in <module>
3
+ sys.exit(cli())
4
+ ~~~^^
5
+ File "/home/duncan/work/code/research/ports/packages/gbnf_experiment/.venv/lib/python3.14/site-packages/click/core.py", line 1631, in __call__
6
+ return self.main(*args, **kwargs)
7
+ ~~~~~~~~~^^^^^^^^^^^^^^^^^
8
+ File "/home/duncan/work/code/research/ports/packages/gbnf_experiment/.venv/lib/python3.14/site-packages/click/core.py", line 1552, in main
9
+ rv = self.invoke(ctx)
10
+ File "/home/duncan/work/code/research/ports/packages/gbnf_experiment/.venv/lib/python3.14/site-packages/click/core.py", line 1415, in invoke
11
+ return ctx.invoke(self.callback, **ctx.params)
12
+ ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
+ File "/home/duncan/work/code/research/ports/packages/gbnf_experiment/.venv/lib/python3.14/site-packages/click/core.py", line 910, in invoke
14
+ return callback(*args, **kwargs)
15
+ File "/home/duncan/work/code/research/ports/packages/gbnf_experiment/src/gbnf_experiment/cli.py", line 62, in cli
16
+ asyncio.run(
17
+ ~~~~~~~~~~~^
18
+ run_gbnf_experiment(
19
+ ^^^^^^^^^^^^^^^^^^^^
20
+ ...<8 lines>...
21
+ )
22
+ ^
23
+ )
24
+ ^
25
+ File "/home/duncan/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/asyncio/runners.py", line 204, in run
26
+ return runner.run(main)
27
+ ~~~~~~~~~~^^^^^^
28
+ File "/home/duncan/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/asyncio/runners.py", line 127, in run
29
+ return self._loop.run_until_complete(task)
30
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
31
+ File "/home/duncan/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/asyncio/base_events.py", line 719, in run_until_complete
32
+ return future.result()
33
+ ~~~~~~~~~~~~~^^
34
+ File "/home/duncan/work/code/research/ports/packages/gbnf_experiment/src/gbnf_experiment/run_gbnf_experiment.py", line 75, in run_gbnf_experiment
35
+ raise AgentFailed(report.get("result", f"the agent exited {result.exit_code}"))
36
+ gbnf_experiment.run_gbnf_experiment.AgentFailed: the agent exited 137
v2-models-effort/runs/20261028-095511-delicate-sound/stderr.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Killed
v2-models-effort/runs/20261028-095511-delicate-sound/stdout.log ADDED
@@ -0,0 +1 @@
 
 
1
+ *** auth: subscription ***
v2-models-effort/runs/20261028-095511-delicate-sound/transcript/.claude/projects/-target/bcce314f-c5c9-42a3-b6b7-b98e8f2df9b5.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
v2-models-effort/runs/20261028-095511-dry-moon/credentials.log ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [2026-10-28 19:26:46.778][39][warning][main] [source/server/server.cc:1012] There is no configured limit to the number of allowed active downstream connections. Configure a limit in `envoy.resource_monitors.global_downstream_max_connections` resource monitor.
2
+ [2026-10-28T19:26:47.644Z] POST /v1/messages?beta=true 200 - 2709ms
3
+ [2026-10-28T19:26:50.436Z] POST /v1/messages?beta=true 200 - 2314ms
4
+ [2026-10-28T19:26:52.784Z] POST /v1/messages?beta=true 200 - 3758ms
5
+ [2026-10-28T19:26:56.561Z] POST /v1/messages?beta=true 200 - 5047ms
6
+ [2026-10-28T19:27:01.635Z] POST /v1/messages?beta=true 200 - 3341ms
7
+ [2026-10-28T19:27:05.000Z] POST /v1/messages?beta=true 200 - 2277ms
8
+ [2026-10-28T19:27:07.329Z] POST /v1/messages?beta=true 200 - 3454ms
9
+ [2026-10-28T19:27:10.806Z] POST /v1/messages?beta=true 200 - 4824ms
10
+ [2026-10-28T19:27:15.662Z] POST /v1/messages?beta=true 200 - 3189ms
11
+ [2026-10-28T19:27:18.897Z] POST /v1/messages?beta=true 200 - 9044ms
12
+ [2026-10-28T19:27:27.973Z] POST /v1/messages?beta=true 200 - 3656ms
13
+ [2026-10-28T19:27:31.657Z] POST /v1/messages?beta=true 200 - 4973ms
14
+ [2026-10-28T19:27:36.686Z] POST /v1/messages?beta=true 200 - 3214ms
15
+ [2026-10-28T19:27:39.935Z] POST /v1/messages?beta=true 200 - 3623ms
16
+ [2026-10-28T19:27:43.591Z] POST /v1/messages?beta=true 200 - 105419ms
17
+ [2026-10-28T19:29:29.229Z] POST /v1/messages?beta=true 200 - 25653ms
18
+ [2026-10-28T19:29:54.929Z] POST /v1/messages?beta=true 200 - 1866ms
19
+ [2026-10-28T19:29:56.825Z] POST /v1/messages?beta=true 200 - 20916ms
20
+ [2026-10-28T19:30:18.370Z] POST /v1/messages?beta=true 200 - 9744ms
21
+ [2026-10-28T19:30:28.387Z] POST /v1/messages?beta=true 200 - 6355ms
22
+ [2026-10-28T19:30:35.078Z] POST /v1/messages?beta=true 200 - 13405ms
23
+ [2026-10-28T19:30:48.762Z] POST /v1/messages?beta=true 200 - 148077ms
24
+ [2026-10-28T19:33:17.942Z] POST /v1/messages?beta=true 200 - 6297ms
25
+ [2026-10-28T19:33:24.775Z] POST /v1/messages?beta=true 200 - 192307ms
26
+ [2026-10-28T19:36:37.195Z] POST /v1/messages?beta=true 200 - 24859ms
27
+ [2026-10-28T19:37:02.192Z] POST /v1/messages?beta=true 200 - 8395ms
28
+ [2026-10-28T19:37:10.711Z] POST /v1/messages?beta=true 200 - 4613ms
29
+ [2026-10-28T19:37:15.443Z] POST /v1/messages?beta=true 200 - 87061ms
30
+ [2026-10-28T19:38:42.535Z] POST /v1/messages?beta=true 200 - 125807ms
31
+ [2026-10-28T19:40:48.499Z] POST /v1/messages?beta=true 200 - 139224ms
32
+ [2026-10-28T19:43:07.861Z] POST /v1/messages?beta=true 200 - 51762ms
33
+ [2026-10-28T19:43:59.644Z] POST /v1/messages?beta=true 200 - 116585ms
34
+ [2026-10-28T19:45:56.258Z] POST /v1/messages?beta=true 200 - 28487ms
35
+ [2026-10-28T19:46:24.794Z] POST /v1/messages?beta=true 200 - 2739ms
36
+ [2026-10-28T19:46:29.674Z] POST /v1/messages?beta=true 200 - 40310ms
37
+ [2026-10-28T19:47:11.958Z] POST /v1/messages?beta=true 200 - 11254ms
38
+ [2026-10-28T19:47:23.768Z] POST /v1/messages?beta=true 200 - 3691ms
39
+ [2026-10-28T19:47:27.802Z] POST /v1/messages?beta=true 200 - 73354ms
40
+ [2026-10-28T19:49:48.758Z] POST /v1/messages?beta=true 200 - 29950ms
41
+ [2026-10-28T19:50:20.413Z] POST /v1/messages?beta=true 200 - 12398ms
42
+ [2026-10-28 19:50:33.090][39][warning][main] [source/server/server.cc:981] caught ENVOY_SIGTERM
v2-models-effort/runs/20261028-095511-dry-moon/manifest.json ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "timestamp": "2026-10-28T19:26:31Z",
3
+ "completed_at": "2026-10-28T19:50:33Z",
4
+ "exit_code": 0,
5
+ "oom_killed": false,
6
+ "condition": {
7
+ "name": "source-javascript_unit-tests_source-integration-tests_effort-xhigh_model-claude-fable-5-1",
8
+ "source_language": "javascript",
9
+ "target_language": "python",
10
+ "include_unit_tests": true,
11
+ "include_source_integration_tests": true,
12
+ "include_target_integration_tests": false,
13
+ "effort": "xhigh",
14
+ "model": "claude-fable-5-1"
15
+ },
16
+ "derivation": {
17
+ "gbnf_commit": "13f1aca495d11e160fffd68c4ba299a2415909d8"
18
+ },
19
+ "reference_implementation": {
20
+ "included": [
21
+ "javascript/.eslintrc.cjs",
22
+ "javascript/.gitignore",
23
+ "javascript/.npmignore",
24
+ "javascript/README.md",
25
+ "javascript/integration-tests/.gitignore",
26
+ "javascript/integration-tests/generated/iteration/grammars.test.ts",
27
+ "javascript/integration-tests/generated/iteration/iteration-with-additional-strings.test.ts",
28
+ "javascript/integration-tests/generated/iteration/iteration-with-an-initial-string.test.ts",
29
+ "javascript/integration-tests/generated/iteration/iteration.test.ts",
30
+ "javascript/integration-tests/generated/validation/validate-grammar.test.ts",
31
+ "javascript/integration-tests/generated/validation/validate-input.test.ts",
32
+ "javascript/package.json",
33
+ "javascript/src/gbnf.test.ts",
34
+ "javascript/src/gbnf.ts",
35
+ "javascript/src/grammar-graph/colorize.test.ts",
36
+ "javascript/src/grammar-graph/colorize.ts",
37
+ "javascript/src/grammar-graph/generic-set.test.ts",
38
+ "javascript/src/grammar-graph/generic-set.ts",
39
+ "javascript/src/grammar-graph/get-input-as-code-points.test.ts",
40
+ "javascript/src/grammar-graph/get-input-as-code-points.ts",
41
+ "javascript/src/grammar-graph/get-parent-stack-id.test.ts",
42
+ "javascript/src/grammar-graph/get-parent-stack-id.ts",
43
+ "javascript/src/grammar-graph/get-serialized-rule-key.test.ts",
44
+ "javascript/src/grammar-graph/get-serialized-rule-key.ts",
45
+ "javascript/src/grammar-graph/graph-node.test.ts",
46
+ "javascript/src/grammar-graph/graph-node.ts",
47
+ "javascript/src/grammar-graph/graph-pointer.test.ts",
48
+ "javascript/src/grammar-graph/graph-pointer.ts",
49
+ "javascript/src/grammar-graph/graph.test.ts",
50
+ "javascript/src/grammar-graph/graph.ts",
51
+ "javascript/src/grammar-graph/index.ts",
52
+ "javascript/src/grammar-graph/parse-state.test.ts",
53
+ "javascript/src/grammar-graph/parse-state.ts",
54
+ "javascript/src/grammar-graph/print.test.ts",
55
+ "javascript/src/grammar-graph/print.ts",
56
+ "javascript/src/grammar-graph/rule-ref.test.ts",
57
+ "javascript/src/grammar-graph/rule-ref.ts",
58
+ "javascript/src/grammar-graph/type-guards.test.ts",
59
+ "javascript/src/grammar-graph/type-guards.ts",
60
+ "javascript/src/grammar-graph/types.ts",
61
+ "javascript/src/grammar-parser/build-rule-stack.test.ts",
62
+ "javascript/src/grammar-parser/build-rule-stack.ts",
63
+ "javascript/src/index.ts",
64
+ "javascript/src/rules-builder/index.ts",
65
+ "javascript/src/rules-builder/is-word-char.test.ts",
66
+ "javascript/src/rules-builder/is-word-char.ts",
67
+ "javascript/src/rules-builder/parse-char.test.ts",
68
+ "javascript/src/rules-builder/parse-char.ts",
69
+ "javascript/src/rules-builder/parse-name.test.ts",
70
+ "javascript/src/rules-builder/parse-name.ts",
71
+ "javascript/src/rules-builder/parse-space.test.ts",
72
+ "javascript/src/rules-builder/parse-space.ts",
73
+ "javascript/src/rules-builder/rules-builder.test.ts",
74
+ "javascript/src/rules-builder/rules-builder.ts",
75
+ "javascript/src/rules-builder/symbol-ids.ts",
76
+ "javascript/src/rules-builder/type-guards.ts",
77
+ "javascript/src/rules-builder/types.ts",
78
+ "javascript/src/umd.ts",
79
+ "javascript/src/utils/errors/build-error-position.test.ts",
80
+ "javascript/src/utils/errors/build-error-position.ts",
81
+ "javascript/src/utils/errors/get-input-as-string.test.ts",
82
+ "javascript/src/utils/errors/get-input-as-string.ts",
83
+ "javascript/src/utils/errors/grammar-parse-error.test.ts",
84
+ "javascript/src/utils/errors/grammar-parse-error.ts",
85
+ "javascript/src/utils/errors/input-parse-error.test.ts",
86
+ "javascript/src/utils/errors/input-parse-error.ts",
87
+ "javascript/src/utils/is-point-in-range.test.ts",
88
+ "javascript/src/utils/is-point-in-range.ts",
89
+ "javascript/tsconfig.json",
90
+ "javascript/tsconfig.test.json",
91
+ "javascript/vite.config.esm.ts",
92
+ "javascript/vite.config.ts",
93
+ "javascript/vite.config.umd.ts",
94
+ "javascript/vitest.config.integration.ts",
95
+ "javascript/vitest.config.unit.ts"
96
+ ]
97
+ },
98
+ "sandbox": {
99
+ "image_id": "sha256:e79ce3df66b1a89b6f259b9aa5ef8ca8338e0778e3ac510074fedf1b9a501e82"
100
+ },
101
+ "harness": {
102
+ "commit": "9cc083f76e4bde3104981c98791b8c3a9e1bd75e",
103
+ "dirty": true
104
+ }
105
+ }
v2-models-effort/runs/20261028-095511-dry-moon/memory.jsonl ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time": 1793215591.1682954, "rss": 36335616, "processes": 3}
2
+ {"time": 1793215596.1835358, "rss": 125575168, "processes": 5}
3
+ {"time": 1793215601.197244, "rss": 125718528, "processes": 5}
4
+ {"time": 1793215606.2149422, "rss": 137474048, "processes": 6}
5
+ {"time": 1793215611.2322443, "rss": 137588736, "processes": 6}
6
+ {"time": 1793215616.245877, "rss": 137588736, "processes": 6}
7
+ {"time": 1793215621.264456, "rss": 137588736, "processes": 6}
8
+ {"time": 1793215626.2800734, "rss": 137588736, "processes": 6}
9
+ {"time": 1793215631.2946317, "rss": 137592832, "processes": 6}
10
+ {"time": 1793215636.3130736, "rss": 137617408, "processes": 6}
11
+ {"time": 1793215641.331049, "rss": 137650176, "processes": 6}
12
+ {"time": 1793215646.3480382, "rss": 137650176, "processes": 6}
13
+ {"time": 1793215651.361396, "rss": 137654272, "processes": 6}
14
+ {"time": 1793215656.3750017, "rss": 137654272, "processes": 6}
15
+ {"time": 1793215661.3888996, "rss": 137654272, "processes": 6}
16
+ {"time": 1793215666.4029093, "rss": 137654272, "processes": 6}
17
+ {"time": 1793215671.4175966, "rss": 137654272, "processes": 6}
18
+ {"time": 1793215676.4315984, "rss": 137654272, "processes": 6}
19
+ {"time": 1793215681.445923, "rss": 137654272, "processes": 6}
20
+ {"time": 1793215686.459321, "rss": 137654272, "processes": 6}
21
+ {"time": 1793215691.4728217, "rss": 137654272, "processes": 6}
22
+ {"time": 1793215696.4866967, "rss": 137654272, "processes": 6}
23
+ {"time": 1793215701.5001485, "rss": 137654272, "processes": 6}
24
+ {"time": 1793215706.513208, "rss": 137654272, "processes": 6}
25
+ {"time": 1793215711.529567, "rss": 137654272, "processes": 6}
26
+ {"time": 1793215716.5448227, "rss": 137654272, "processes": 6}
27
+ {"time": 1793215721.5588603, "rss": 137654272, "processes": 6}
28
+ {"time": 1793215726.5761847, "rss": 137654272, "processes": 6}
29
+ {"time": 1793215731.590536, "rss": 137654272, "processes": 6}
30
+ {"time": 1793215736.6052089, "rss": 137654272, "processes": 6}
31
+ {"time": 1793215741.6213245, "rss": 137654272, "processes": 6}
32
+ {"time": 1793215746.638408, "rss": 137654272, "processes": 6}
33
+ {"time": 1793215751.6538575, "rss": 137654272, "processes": 6}
34
+ {"time": 1793215756.6674757, "rss": 138043392, "processes": 6}
35
+ {"time": 1793215761.6801026, "rss": 138383360, "processes": 6}
36
+ {"time": 1793215766.6934767, "rss": 138383360, "processes": 6}
37
+ {"time": 1793215771.7070363, "rss": 138706944, "processes": 6}
38
+ {"time": 1793215776.720811, "rss": 138706944, "processes": 6}
39
+ {"time": 1793215781.7344427, "rss": 138706944, "processes": 6}
40
+ {"time": 1793215786.7482567, "rss": 138706944, "processes": 6}
41
+ {"time": 1793215791.7656412, "rss": 138706944, "processes": 6}
42
+ {"time": 1793215796.7794762, "rss": 138706944, "processes": 6}
43
+ {"time": 1793215801.7971675, "rss": 138706944, "processes": 6}
44
+ {"time": 1793215806.814729, "rss": 138711040, "processes": 6}
45
+ {"time": 1793215811.8291945, "rss": 138711040, "processes": 6}
46
+ {"time": 1793215816.8428981, "rss": 138711040, "processes": 6}
47
+ {"time": 1793215821.857716, "rss": 138711040, "processes": 6}
48
+ {"time": 1793215826.8716316, "rss": 138711040, "processes": 6}
49
+ {"time": 1793215831.8871863, "rss": 138711040, "processes": 6}
50
+ {"time": 1793215836.9022028, "rss": 138711040, "processes": 6}
51
+ {"time": 1793215841.9160671, "rss": 138711040, "processes": 6}
52
+ {"time": 1793215846.932114, "rss": 138711040, "processes": 6}
53
+ {"time": 1793215851.9453995, "rss": 138711040, "processes": 6}
54
+ {"time": 1793215856.9587407, "rss": 138711040, "processes": 6}
55
+ {"time": 1793215861.9726837, "rss": 138711040, "processes": 6}
56
+ {"time": 1793215866.9851367, "rss": 138711040, "processes": 6}
57
+ {"time": 1793215871.997943, "rss": 138711040, "processes": 6}
58
+ {"time": 1793215877.0114481, "rss": 138780672, "processes": 6}
59
+ {"time": 1793215882.0242739, "rss": 138936320, "processes": 6}
60
+ {"time": 1793215887.0375443, "rss": 138936320, "processes": 6}
61
+ {"time": 1793215892.0526195, "rss": 138940416, "processes": 6}
62
+ {"time": 1793215897.0657651, "rss": 138940416, "processes": 6}
63
+ {"time": 1793215902.0786445, "rss": 138940416, "processes": 6}
64
+ {"time": 1793215907.0911245, "rss": 138940416, "processes": 6}
65
+ {"time": 1793215912.1047704, "rss": 139071488, "processes": 6}
66
+ {"time": 1793215917.1193633, "rss": 139071488, "processes": 6}
67
+ {"time": 1793215922.1330962, "rss": 139071488, "processes": 6}
68
+ {"time": 1793215927.1497223, "rss": 139071488, "processes": 6}
69
+ {"time": 1793215932.1626577, "rss": 139071488, "processes": 6}
70
+ {"time": 1793215937.1775827, "rss": 137629696, "processes": 6}
71
+ {"time": 1793215942.190924, "rss": 137629696, "processes": 6}
72
+ {"time": 1793215947.2053962, "rss": 137629696, "processes": 6}
73
+ {"time": 1793215952.2178972, "rss": 137629696, "processes": 6}
74
+ {"time": 1793215957.2313066, "rss": 137629696, "processes": 6}
75
+ {"time": 1793215962.2439299, "rss": 137629696, "processes": 6}
76
+ {"time": 1793215967.2574694, "rss": 137629696, "processes": 6}
77
+ {"time": 1793215972.271358, "rss": 136994816, "processes": 6}
78
+ {"time": 1793215977.284467, "rss": 136994816, "processes": 6}
79
+ {"time": 1793215982.297043, "rss": 136994816, "processes": 6}
80
+ {"time": 1793215987.3100057, "rss": 136994816, "processes": 6}
81
+ {"time": 1793215992.3277855, "rss": 136994816, "processes": 6}
82
+ {"time": 1793215997.3422203, "rss": 137056256, "processes": 6}
83
+ {"time": 1793216002.3559787, "rss": 137314304, "processes": 6}
84
+ {"time": 1793216007.3699157, "rss": 137314304, "processes": 6}
85
+ {"time": 1793216012.3856673, "rss": 137314304, "processes": 6}
86
+ {"time": 1793216017.3990378, "rss": 137314304, "processes": 6}
87
+ {"time": 1793216022.4133215, "rss": 137314304, "processes": 6}
88
+ {"time": 1793216027.426895, "rss": 137314304, "processes": 6}
89
+ {"time": 1793216032.4410193, "rss": 137314304, "processes": 6}
90
+ {"time": 1793216037.4554248, "rss": 137314304, "processes": 6}
91
+ {"time": 1793216042.4685862, "rss": 137314304, "processes": 6}
92
+ {"time": 1793216047.4817238, "rss": 137314304, "processes": 6}
93
+ {"time": 1793216052.4953249, "rss": 137314304, "processes": 6}
94
+ {"time": 1793216057.5082014, "rss": 137314304, "processes": 6}
95
+ {"time": 1793216062.5216622, "rss": 137314304, "processes": 6}
96
+ {"time": 1793216067.5360553, "rss": 137412608, "processes": 6}
97
+ {"time": 1793216072.549911, "rss": 137412608, "processes": 6}
98
+ {"time": 1793216077.563225, "rss": 137412608, "processes": 6}
99
+ {"time": 1793216082.576482, "rss": 137412608, "processes": 6}
100
+ {"time": 1793216087.588769, "rss": 137412608, "processes": 6}
101
+ {"time": 1793216092.6026201, "rss": 137412608, "processes": 6}
102
+ {"time": 1793216097.617338, "rss": 137412608, "processes": 6}
103
+ {"time": 1793216102.6307135, "rss": 137412608, "processes": 6}
104
+ {"time": 1793216107.6449249, "rss": 137412608, "processes": 6}
105
+ {"time": 1793216112.6604183, "rss": 137412608, "processes": 6}
106
+ {"time": 1793216117.673923, "rss": 137519104, "processes": 6}
107
+ {"time": 1793216122.6865714, "rss": 137551872, "processes": 6}
108
+ {"time": 1793216127.701441, "rss": 137551872, "processes": 6}
109
+ {"time": 1793216132.714978, "rss": 137551872, "processes": 6}
110
+ {"time": 1793216137.7282956, "rss": 137551872, "processes": 6}
111
+ {"time": 1793216142.7425492, "rss": 137551872, "processes": 6}
112
+ {"time": 1793216147.756414, "rss": 137551872, "processes": 6}
113
+ {"time": 1793216152.769575, "rss": 137551872, "processes": 6}
114
+ {"time": 1793216157.7834706, "rss": 137551872, "processes": 6}
115
+ {"time": 1793216162.7969353, "rss": 137551872, "processes": 6}
116
+ {"time": 1793216167.8096647, "rss": 137551872, "processes": 6}
117
+ {"time": 1793216172.8242202, "rss": 137551872, "processes": 6}
118
+ {"time": 1793216177.8379312, "rss": 137551872, "processes": 6}
119
+ {"time": 1793216182.8520527, "rss": 137551872, "processes": 6}
120
+ {"time": 1793216187.8645165, "rss": 137601024, "processes": 6}
121
+ {"time": 1793216192.8779292, "rss": 137601024, "processes": 6}
122
+ {"time": 1793216197.8920534, "rss": 137601024, "processes": 6}
123
+ {"time": 1793216202.9053323, "rss": 137601024, "processes": 6}
124
+ {"time": 1793216207.9183881, "rss": 137601024, "processes": 6}
125
+ {"time": 1793216212.9318488, "rss": 137601024, "processes": 6}
126
+ {"time": 1793216217.9450014, "rss": 137601024, "processes": 6}
127
+ {"time": 1793216222.9589705, "rss": 137601024, "processes": 6}
128
+ {"time": 1793216227.9728, "rss": 137601024, "processes": 6}
129
+ {"time": 1793216232.9855294, "rss": 137601024, "processes": 6}
130
+ {"time": 1793216238.0003743, "rss": 137650176, "processes": 6}
131
+ {"time": 1793216243.0131748, "rss": 137658368, "processes": 6}
132
+ {"time": 1793216248.0267322, "rss": 137658368, "processes": 6}
133
+ {"time": 1793216253.0401428, "rss": 137658368, "processes": 6}
134
+ {"time": 1793216258.0560327, "rss": 137658368, "processes": 6}
135
+ {"time": 1793216263.0716062, "rss": 137658368, "processes": 6}
136
+ {"time": 1793216268.0890567, "rss": 137658368, "processes": 6}
137
+ {"time": 1793216273.1038322, "rss": 137658368, "processes": 6}
138
+ {"time": 1793216278.117298, "rss": 137658368, "processes": 6}
139
+ {"time": 1793216283.1302607, "rss": 137658368, "processes": 6}
140
+ {"time": 1793216288.1429377, "rss": 137658368, "processes": 6}
141
+ {"time": 1793216293.1553864, "rss": 137658368, "processes": 6}
142
+ {"time": 1793216298.1682436, "rss": 137658368, "processes": 6}
143
+ {"time": 1793216303.1811116, "rss": 137658368, "processes": 6}
144
+ {"time": 1793216308.1938906, "rss": 137658368, "processes": 6}
145
+ {"time": 1793216313.2078328, "rss": 137658368, "processes": 6}
146
+ {"time": 1793216318.2208822, "rss": 137658368, "processes": 6}
147
+ {"time": 1793216323.2341743, "rss": 137728000, "processes": 6}
148
+ {"time": 1793216328.247907, "rss": 137728000, "processes": 6}
149
+ {"time": 1793216333.2607844, "rss": 137728000, "processes": 6}
150
+ {"time": 1793216338.2758782, "rss": 137728000, "processes": 6}
151
+ {"time": 1793216343.2898262, "rss": 137728000, "processes": 6}
152
+ {"time": 1793216348.3022614, "rss": 137728000, "processes": 6}
153
+ {"time": 1793216353.3160129, "rss": 137728000, "processes": 6}
154
+ {"time": 1793216358.3287742, "rss": 137785344, "processes": 6}
155
+ {"time": 1793216363.3434393, "rss": 137785344, "processes": 6}
156
+ {"time": 1793216368.357235, "rss": 137785344, "processes": 6}
157
+ {"time": 1793216373.3698978, "rss": 137785344, "processes": 6}
158
+ {"time": 1793216378.382376, "rss": 137785344, "processes": 6}
159
+ {"time": 1793216383.3963468, "rss": 137785344, "processes": 6}
160
+ {"time": 1793216388.409947, "rss": 137785344, "processes": 6}
161
+ {"time": 1793216393.4244263, "rss": 137785344, "processes": 6}
162
+ {"time": 1793216398.4376771, "rss": 137785344, "processes": 6}
163
+ {"time": 1793216403.4537919, "rss": 137785344, "processes": 6}
164
+ {"time": 1793216408.4667678, "rss": 137785344, "processes": 6}
165
+ {"time": 1793216413.479602, "rss": 137785344, "processes": 6}
166
+ {"time": 1793216418.494294, "rss": 137785344, "processes": 6}
167
+ {"time": 1793216423.5078907, "rss": 137785344, "processes": 6}
168
+ {"time": 1793216428.5206642, "rss": 137785344, "processes": 6}
169
+ {"time": 1793216433.5333354, "rss": 137785344, "processes": 6}
170
+ {"time": 1793216438.5473604, "rss": 137785344, "processes": 6}
171
+ {"time": 1793216443.5637877, "rss": 137822208, "processes": 6}
172
+ {"time": 1793216448.577255, "rss": 137822208, "processes": 6}
173
+ {"time": 1793216453.5903163, "rss": 137822208, "processes": 6}
174
+ {"time": 1793216458.6022704, "rss": 137822208, "processes": 6}
175
+ {"time": 1793216463.6166408, "rss": 137822208, "processes": 6}
176
+ {"time": 1793216468.6294763, "rss": 137822208, "processes": 6}
177
+ {"time": 1793216473.6428125, "rss": 137822208, "processes": 6}
178
+ {"time": 1793216478.655895, "rss": 137826304, "processes": 6}
179
+ {"time": 1793216483.6690648, "rss": 137826304, "processes": 6}
180
+ {"time": 1793216488.6826482, "rss": 137826304, "processes": 6}
181
+ {"time": 1793216493.6952374, "rss": 137826304, "processes": 6}
182
+ {"time": 1793216498.708068, "rss": 137826304, "processes": 6}
183
+ {"time": 1793216503.7216089, "rss": 137826304, "processes": 6}
184
+ {"time": 1793216508.7354324, "rss": 137826304, "processes": 6}
185
+ {"time": 1793216513.7494466, "rss": 137826304, "processes": 6}
186
+ {"time": 1793216518.765051, "rss": 137826304, "processes": 6}
187
+ {"time": 1793216523.7801917, "rss": 137826304, "processes": 6}
188
+ {"time": 1793216528.7934737, "rss": 137826304, "processes": 6}
189
+ {"time": 1793216533.80673, "rss": 137826304, "processes": 6}
190
+ {"time": 1793216538.8201752, "rss": 137826304, "processes": 6}
191
+ {"time": 1793216543.83408, "rss": 137826304, "processes": 6}
192
+ {"time": 1793216548.8461986, "rss": 137826304, "processes": 6}
193
+ {"time": 1793216553.860678, "rss": 137826304, "processes": 6}
194
+ {"time": 1793216558.8752298, "rss": 137826304, "processes": 6}
195
+ {"time": 1793216563.8880513, "rss": 137826304, "processes": 6}
196
+ {"time": 1793216568.9003932, "rss": 137826304, "processes": 6}
197
+ {"time": 1793216573.9134066, "rss": 137826304, "processes": 6}
198
+ {"time": 1793216578.9277093, "rss": 137826304, "processes": 6}
199
+ {"time": 1793216583.9431138, "rss": 137826304, "processes": 6}
200
+ {"time": 1793216588.9566424, "rss": 137826304, "processes": 6}
201
+ {"time": 1793216593.97051, "rss": 137826304, "processes": 6}
202
+ {"time": 1793216598.9846625, "rss": 137834496, "processes": 6}
203
+ {"time": 1793216603.998336, "rss": 137834496, "processes": 6}
204
+ {"time": 1793216609.0138624, "rss": 137834496, "processes": 6}
205
+ {"time": 1793216614.0302145, "rss": 137834496, "processes": 6}
206
+ {"time": 1793216619.0426323, "rss": 137834496, "processes": 6}
207
+ {"time": 1793216624.0559378, "rss": 137834496, "processes": 6}
208
+ {"time": 1793216629.0684702, "rss": 137834496, "processes": 6}
209
+ {"time": 1793216634.0813138, "rss": 137834496, "processes": 6}
210
+ {"time": 1793216639.0938365, "rss": 137834496, "processes": 6}
211
+ {"time": 1793216644.1069, "rss": 137834496, "processes": 6}
212
+ {"time": 1793216649.119907, "rss": 137834496, "processes": 6}
213
+ {"time": 1793216654.1323793, "rss": 137834496, "processes": 6}
214
+ {"time": 1793216659.144573, "rss": 137834496, "processes": 6}
215
+ {"time": 1793216664.1565397, "rss": 137834496, "processes": 6}
216
+ {"time": 1793216669.1687717, "rss": 137834496, "processes": 6}
217
+ {"time": 1793216674.1813986, "rss": 137834496, "processes": 6}
218
+ {"time": 1793216679.194347, "rss": 137834496, "processes": 6}
219
+ {"time": 1793216684.2101858, "rss": 137834496, "processes": 6}
220
+ {"time": 1793216689.2249017, "rss": 137834496, "processes": 6}
221
+ {"time": 1793216694.2387838, "rss": 137834496, "processes": 6}
222
+ {"time": 1793216699.2512407, "rss": 137834496, "processes": 6}
223
+ {"time": 1793216704.2655578, "rss": 137834496, "processes": 6}
224
+ {"time": 1793216709.2795124, "rss": 137834496, "processes": 6}
225
+ {"time": 1793216714.2921388, "rss": 137834496, "processes": 6}
226
+ {"time": 1793216719.3045125, "rss": 137842688, "processes": 6}
227
+ {"time": 1793216724.3166058, "rss": 137842688, "processes": 6}
228
+ {"time": 1793216729.329781, "rss": 137842688, "processes": 6}
229
+ {"time": 1793216734.3436835, "rss": 137842688, "processes": 6}
230
+ {"time": 1793216739.3566341, "rss": 137842688, "processes": 6}
231
+ {"time": 1793216744.3699698, "rss": 137842688, "processes": 6}
232
+ {"time": 1793216749.3837276, "rss": 137842688, "processes": 6}
233
+ {"time": 1793216754.3964877, "rss": 137842688, "processes": 6}
234
+ {"time": 1793216759.4091985, "rss": 137842688, "processes": 6}
235
+ {"time": 1793216764.4234326, "rss": 137842688, "processes": 6}
236
+ {"time": 1793216769.43645, "rss": 137842688, "processes": 6}
237
+ {"time": 1793216774.4501252, "rss": 137842688, "processes": 6}
238
+ {"time": 1793216779.4630291, "rss": 137842688, "processes": 6}
239
+ {"time": 1793216784.4770494, "rss": 137842688, "processes": 6}
240
+ {"time": 1793216789.4913025, "rss": 137842688, "processes": 6}
241
+ {"time": 1793216794.5046213, "rss": 137842688, "processes": 6}
242
+ {"time": 1793216799.5181236, "rss": 137842688, "processes": 6}
243
+ {"time": 1793216804.5317063, "rss": 137842688, "processes": 6}
244
+ {"time": 1793216809.54486, "rss": 137842688, "processes": 6}
245
+ {"time": 1793216814.5599356, "rss": 137842688, "processes": 6}
246
+ {"time": 1793216819.5742073, "rss": 137842688, "processes": 6}
247
+ {"time": 1793216824.5881312, "rss": 137842688, "processes": 6}
248
+ {"time": 1793216829.601879, "rss": 137842688, "processes": 6}
249
+ {"time": 1793216834.614953, "rss": 137875456, "processes": 6}
250
+ {"time": 1793216839.6278236, "rss": 137875456, "processes": 6}
251
+ {"time": 1793216844.6410153, "rss": 137875456, "processes": 6}
252
+ {"time": 1793216849.6556275, "rss": 137875456, "processes": 6}
253
+ {"time": 1793216854.66915, "rss": 137875456, "processes": 6}
254
+ {"time": 1793216859.6820488, "rss": 137875456, "processes": 6}
255
+ {"time": 1793216864.697195, "rss": 137875456, "processes": 6}
256
+ {"time": 1793216869.7104585, "rss": 137875456, "processes": 6}
257
+ {"time": 1793216874.7250977, "rss": 137875456, "processes": 6}
258
+ {"time": 1793216879.737809, "rss": 137875456, "processes": 6}
259
+ {"time": 1793216884.7512696, "rss": 137875456, "processes": 6}
260
+ {"time": 1793216889.763561, "rss": 137875456, "processes": 6}
261
+ {"time": 1793216894.775524, "rss": 137875456, "processes": 6}
262
+ {"time": 1793216899.787198, "rss": 137875456, "processes": 6}
263
+ {"time": 1793216904.7989714, "rss": 137875456, "processes": 6}
264
+ {"time": 1793216909.8109937, "rss": 137875456, "processes": 6}
265
+ {"time": 1793216914.822445, "rss": 137875456, "processes": 6}
266
+ {"time": 1793216919.8355517, "rss": 137875456, "processes": 6}
267
+ {"time": 1793216924.849894, "rss": 137875456, "processes": 6}
268
+ {"time": 1793216929.861894, "rss": 137875456, "processes": 6}
269
+ {"time": 1793216934.8738472, "rss": 137875456, "processes": 6}
270
+ {"time": 1793216939.8864179, "rss": 137875456, "processes": 6}
271
+ {"time": 1793216944.9000292, "rss": 137875456, "processes": 6}
272
+ {"time": 1793216949.9122484, "rss": 137875456, "processes": 6}
273
+ {"time": 1793216954.9259806, "rss": 137875456, "processes": 6}
274
+ {"time": 1793216959.937901, "rss": 137875456, "processes": 6}
275
+ {"time": 1793216964.9507372, "rss": 137875456, "processes": 6}
276
+ {"time": 1793216969.962313, "rss": 137875456, "processes": 6}
277
+ {"time": 1793216974.9741542, "rss": 137875456, "processes": 6}
278
+ {"time": 1793216979.987686, "rss": 137875456, "processes": 6}
279
+ {"time": 1793216984.999811, "rss": 137875456, "processes": 6}
280
+ {"time": 1793216990.0122085, "rss": 137875456, "processes": 6}
281
+ {"time": 1793216995.0239732, "rss": 137875456, "processes": 6}
282
+ {"time": 1793217000.0355806, "rss": 137875456, "processes": 6}
283
+ {"time": 1793217005.048648, "rss": 137875456, "processes": 6}
284
+ {"time": 1793217010.0604317, "rss": 137875456, "processes": 6}
285
+ {"time": 1793217015.0716634, "rss": 137875456, "processes": 6}
286
+ {"time": 1793217020.083156, "rss": 137744384, "processes": 6}
287
+ {"time": 1793217025.0940676, "rss": 137744384, "processes": 6}
288
+ {"time": 1793217030.106669, "rss": 137744384, "processes": 6}
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/.gitignore ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ build/
5
+ dist/
6
+ .pytest_cache/
7
+ .venv/
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GBNF
2
+
3
+ A library for parsing `.gbnf` grammar files in Python. This is a port of the
4
+ JavaScript [`gbnf`](https://github.com/ambient-labs/GBNF) package.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ pip install .
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ Pass your grammar to `GBNF`:
15
+
16
+ ```python
17
+ from gbnf import GBNF
18
+
19
+ state = GBNF('''
20
+ root ::= "yes" | "no"
21
+ ''')
22
+ ```
23
+
24
+ If the grammar is invalid, `GBNF` raises a `GrammarParseError`.
25
+
26
+ `GBNF` returns a state representing the parsed state:
27
+
28
+ ```python
29
+ from gbnf import GBNF
30
+
31
+ state = GBNF('''
32
+ root ::= "yes" | "no"
33
+ ''')
34
+ for rule in state:
35
+ print(rule)
36
+ # {'type': 'char', 'value': [ord("y")]}
37
+ # {'type': 'char', 'value': [ord("n")]}
38
+ ```
39
+
40
+ `state` can be iterated over. (You can also call the iterator method directly
41
+ with `state.rules()`.) `state` cannot be indexed directly, but can easily be
42
+ cast to a list with `list(state)` and indexed that way.
43
+
44
+ States are _immutable_. To parse a new token, call `state.add()` (the state is
45
+ also callable, so `state("...")` does the same thing):
46
+
47
+ ```python
48
+ from gbnf import GBNF
49
+
50
+ state = GBNF('''
51
+ root ::= "I like green eggs and ham"
52
+ ''')
53
+ print(list(state)) # [{'type': 'char', 'value': [ord("I")]}]
54
+ state = state.add("I li")
55
+ print(list(state)) # [{'type': 'char', 'value': [ord("k")]}]
56
+ state = state.add("ke gree")
57
+ print(list(state)) # [{'type': 'char', 'value': [ord("n")]}]
58
+ ```
59
+
60
+ If the input is not accepted by the grammar, `add` raises an `InputParseError`.
61
+
62
+ The possible rules returned are dicts with a `type` (a `RuleType` value) and,
63
+ for character rules, a `value`:
64
+
65
+ - `RuleType.CHAR` (`"char"`) - `value` is a list of either integers
66
+ representing code points to match, _or_ two-element lists denoting an
67
+ inclusive range within which a code point may appear.
68
+ - `RuleType.CHAR_EXCLUDE` (`"char_exclude"`) - `value` is a list of integers
69
+ representing code points _not_ to match, _or_ two-element lists denoting a
70
+ range within which a code point may _not_ appear.
71
+ - `RuleType.END` (`"end"`) - denotes a valid end of a string.
72
+
73
+ Use `is_range(value)` to tell a range from a single code point.
74
+
75
+ ## Development
76
+
77
+ ```bash
78
+ pytest
79
+ ```
80
+
81
+ Unit tests live in `tests/unit` and integration tests in `tests/integration`.
82
+
83
+ ## Differences from the JavaScript reference
84
+
85
+ The port keeps the reference's structure and behavior, with these deliberate
86
+ exceptions:
87
+
88
+ - **Rules are plain dicts.** A rule is `{"type": RuleType.CHAR, "value": [...]}`;
89
+ `RuleType` is a `StrEnum`, so `rule["type"] == "char"` also holds. Ranges are
90
+ two-element lists.
91
+ - **Code points, not UTF-16 units.** Grammars and input are handled as Python
92
+ code points, so an astral character such as `💩` is a single value whether it
93
+ is written literally or as `\U0001F4A9`. The reference splits such
94
+ characters into surrogate pairs.
95
+ - **Grammar errors are always `GrammarParseError`.** A grammar with no `root`
96
+ rule, or a rule referenced only from a generated sub-rule (`root ::= foo*`)
97
+ but never defined, raises `GrammarParseError`; the reference raises a generic
98
+ `Error`/`TypeError` there. The "no root symbol" message lists the available
99
+ symbol names.
100
+ - **Hex escapes need digits.** `\x`, `\u` and `\U` escapes with no hex digits
101
+ raise `GrammarParseError` instead of silently matching nothing.
102
+ - **Pointer resolution is iterative.** Long runs of a repeated rule (`"x"*`
103
+ over thousands of characters) do not hit Python's recursion limit.
104
+ - `ParseState` is callable through `__call__` rather than a `Proxy`, and
105
+ `GBNF` accepts any object whose `str()` is a grammar in place of the
106
+ reference's `GBNFRule` type.
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """A library for parsing GBNF grammars."""
2
+
3
+ from .gbnf import GBNF
4
+ from .grammar_graph.parse_state import ParseState
5
+ from .grammar_graph.type_guards import is_range
6
+ from .grammar_graph.types import Range, ResolvedRule, RuleChar, RuleCharExclude, RuleEnd, RuleType
7
+ from .utils.errors.grammar_parse_error import GrammarParseError
8
+ from .utils.errors.input_parse_error import InputParseError
9
+
10
+ Rule = ResolvedRule
11
+
12
+ __version__ = "0.1.41"
13
+
14
+ __all__ = [
15
+ "GBNF",
16
+ "GrammarParseError",
17
+ "InputParseError",
18
+ "ParseState",
19
+ "Range",
20
+ "Rule",
21
+ "RuleChar",
22
+ "RuleCharExclude",
23
+ "RuleEnd",
24
+ "RuleType",
25
+ "is_range",
26
+ ]
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/gbnf.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from typing import Any
5
+
6
+ from .grammar_graph.graph import Graph
7
+ from .grammar_graph.parse_state import ParseState
8
+ from .grammar_graph.types import UnresolvedRule, ValidInput
9
+ from .grammar_parser.build_rule_stack import build_rule_stack
10
+ from .rules_builder import RulesBuilder
11
+ from .utils.errors.grammar_parse_error import GrammarParseError
12
+
13
+
14
+ def GBNF(input: str | Any, initial_string: ValidInput = "") -> ParseState: # noqa: N802 - public API name
15
+ """Parse a GBNF grammar and return the initial parse state.
16
+
17
+ ``input`` is the grammar text (anything else is converted with ``str``).
18
+ ``initial_string`` is optional input to parse immediately.
19
+ Raises ``GrammarParseError`` for an invalid grammar and ``InputParseError``
20
+ for an initial string the grammar does not accept.
21
+ """
22
+ grammar = input if isinstance(input, str) else str(input)
23
+ builder = RulesBuilder(grammar)
24
+ rules, symbol_ids = builder.rules, builder.symbol_ids
25
+ if len(rules) == 0:
26
+ raise GrammarParseError(grammar, 0, "No rules were found")
27
+ if "root" not in symbol_ids:
28
+ raise GrammarParseError(
29
+ grammar,
30
+ 0,
31
+ f"Grammar does not contain a root symbol. Available symbols are: {json.dumps(list(symbol_ids.keys()))}",
32
+ )
33
+ root_id = symbol_ids.get("root")
34
+
35
+ stacked_rules: list[list[list[UnresolvedRule]]] = [build_rule_stack(rule) for rule in rules]
36
+ graph = Graph(grammar, stacked_rules, root_id)
37
+ return ParseState(graph, graph.add(initial_string))
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from .graph import Graph
2
+
3
+ __all__ = ["Graph"]
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/colorize.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Callable
2
+ from enum import StrEnum
3
+
4
+
5
+ class Color(StrEnum):
6
+ BLUE = "\x1b[34m"
7
+ CYAN = "\x1b[36m"
8
+ GREEN = "\x1b[32m"
9
+ RED = "\x1b[31m"
10
+ GRAY = "\x1b[90m"
11
+ YELLOW = "\x1b[33m"
12
+
13
+
14
+ def colorize(s: str | int, color: Color) -> str:
15
+ return f"{color}{s}"
16
+
17
+
18
+ Colorize = Callable[[str | int, Color], str]
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/generic_set.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Callable, Iterator
2
+ from typing import Generic, TypeVar
3
+
4
+ T = TypeVar("T")
5
+ K = TypeVar("K")
6
+
7
+
8
+ class GenericSet(Generic[T, K]):
9
+ """An insertion-ordered set whose identity is defined by a key function."""
10
+
11
+ def __init__(self, get_key: Callable[[T], K]):
12
+ self.get_key = get_key
13
+ self._items: dict[K, T] = {}
14
+
15
+ def add(self, el: T) -> None:
16
+ key = self.get_key(el)
17
+ if key not in self._items:
18
+ self._items[key] = el
19
+
20
+ def delete(self, el: T) -> None:
21
+ key = self.get_key(el)
22
+ if key not in self._items:
23
+ raise RuntimeError("Could not get ref")
24
+ del self._items[key]
25
+
26
+ def has(self, el: T) -> bool:
27
+ key = self.get_key(el)
28
+ if key not in self._items:
29
+ return False
30
+ stored = self._items[key]
31
+ return stored is el or stored == el
32
+
33
+ def __contains__(self, el: object) -> bool:
34
+ return self.has(el) # type: ignore[arg-type]
35
+
36
+ def get(self, el: T) -> T | None:
37
+ return self._items.get(self.get_key(el))
38
+
39
+ def __iter__(self) -> Iterator[T]:
40
+ yield from self._items.values()
41
+
42
+ @property
43
+ def size(self) -> int:
44
+ return len(self._items)
45
+
46
+ def __len__(self) -> int:
47
+ return len(self._items)
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/get_input_as_code_points.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from .types import ValidInput
2
+
3
+
4
+ def get_input_as_code_points(src: ValidInput) -> list[int]:
5
+ if not isinstance(src, str):
6
+ return [src] if isinstance(src, int) else list(src)
7
+
8
+ return [ord(char) for char in src]
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/get_parent_stack_id.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from .colorize import Color, Colorize
6
+
7
+ if TYPE_CHECKING:
8
+ from .graph_pointer import GraphPointer
9
+
10
+
11
+ def get_parent_stack_id(pointer: GraphPointer, col: Colorize) -> str:
12
+ stack_ids: list[str] = []
13
+ parent: GraphPointer | None = pointer.parent
14
+ while parent is not None:
15
+ meta = parent.node.meta
16
+ stack_ids.append(f"{meta.stack_id},{meta.path_id},{meta.step_id}")
17
+ parent = parent.parent
18
+ return col("<-", Color.GRAY).join(col(stack_id, Color.RED) for stack_id in stack_ids)
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/get_serialized_rule_key.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from typing import Any
3
+
4
+ from .type_guards import is_rule_char, is_rule_char_excluded, is_rule_end, is_rule_ref
5
+ from .types import RuleType, UnresolvedRule
6
+
7
+ KEY_TRANSLATION = {
8
+ RuleType.END: 0,
9
+ RuleType.CHAR: 1,
10
+ RuleType.CHAR_EXCLUDE: 2,
11
+ }
12
+
13
+
14
+ def _stringify(value: Any) -> str:
15
+ try:
16
+ return json.dumps(value, separators=(",", ":"))
17
+ except TypeError:
18
+ return repr(value)
19
+
20
+
21
+ def get_serialized_rule_key(rule: UnresolvedRule) -> str:
22
+ if is_rule_end(rule):
23
+ return f"{KEY_TRANSLATION[RuleType.END]}"
24
+
25
+ if is_rule_char(rule) or is_rule_char_excluded(rule):
26
+ return f"{KEY_TRANSLATION[rule['type']]}-{_stringify(rule['value'])}"
27
+ if is_rule_ref(rule):
28
+ return f"3-{rule.value}"
29
+ raise ValueError(f"Unknown rule type: {_stringify(rule)}")
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/graph.py ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from collections.abc import Iterable, Iterator
5
+
6
+ from ..utils.errors.input_parse_error import InputParseError
7
+ from ..utils.is_point_in_range import is_point_in_range
8
+ from .colorize import colorize
9
+ from .generic_set import GenericSet
10
+ from .get_input_as_code_points import get_input_as_code_points
11
+ from .get_serialized_rule_key import get_serialized_rule_key
12
+ from .graph_node import GraphNode, GraphNodeMeta
13
+ from .graph_pointer import GraphPointer
14
+ from .rule_ref import RuleRef
15
+ from .type_guards import is_range, is_rule_char, is_rule_char_excluded, is_rule_end, is_rule_ref
16
+ from .types import UnresolvedRule, ValidInput
17
+
18
+ RootNode = dict[int, GraphNode]
19
+ Pointers = GenericSet[GraphPointer, str]
20
+
21
+
22
+ def _make_pointers() -> Pointers:
23
+ return GenericSet(lambda p: p.id)
24
+
25
+
26
+ class Graph:
27
+ grammar: str
28
+
29
+ def __init__(self, grammar: str, stacked_rules: list[list[list[UnresolvedRule]]], root_id: int):
30
+ self._roots: dict[int, RootNode] = {}
31
+ self.grammar = grammar
32
+ self._previous_code_points: list[int] = []
33
+ rule_refs: list[RuleRef] = []
34
+ unique_rules: GenericSet[UnresolvedRule, str] = GenericSet(get_serialized_rule_key)
35
+ for stack_id, stack in enumerate(stacked_rules):
36
+ nodes: RootNode = {}
37
+ for path_id, path in enumerate(stack):
38
+ node: GraphNode | None = None
39
+ for step_id in range(len(path) - 1, -1, -1):
40
+ next_node = node
41
+ rule = stack[path_id][step_id]
42
+ unique_rules.add(rule)
43
+ if is_rule_ref(rule):
44
+ rule_refs.append(rule)
45
+ # rules coming in may be identical but have different references.
46
+ # here, we ensure we always use the same reference for an identical rule.
47
+ # this makes future comparisons easier.
48
+ unique_rule = unique_rules.get(rule)
49
+ if unique_rule is None:
50
+ raise RuntimeError("Could not get unique rule")
51
+ node = GraphNode(unique_rule, GraphNodeMeta(stack_id, path_id, step_id), next_node)
52
+ if node is None:
53
+ raise RuntimeError("Could not get node")
54
+ nodes[path_id] = node
55
+
56
+ self._roots[stack_id] = nodes
57
+ root_node = self._roots.get(root_id)
58
+ if root_node is None:
59
+ raise RuntimeError(f"Root node not found for value: {root_id}")
60
+ self._root_node: RootNode = root_node
61
+
62
+ for rule_ref in rule_refs:
63
+ rule_ref.nodes = list(self._get_root_node(rule_ref.value).values())
64
+
65
+ def _get_root_node(self, value: int) -> RootNode:
66
+ root_node = self._roots.get(value)
67
+ if root_node is None:
68
+ raise RuntimeError(f"Root node not found for value: {value}")
69
+ return root_node
70
+
71
+ def _get_initial_pointers(self) -> Pointers:
72
+ pointers = _make_pointers()
73
+
74
+ root_node = self._root_node
75
+ if root_node is None:
76
+ raise RuntimeError("Root node is not defined")
77
+
78
+ for node, parent in self._fetch_nodes_for_root_node(root_node):
79
+ pointer = GraphPointer(node, parent)
80
+ for resolved_pointer in self._resolve_pointer(pointer):
81
+ pointers.add(resolved_pointer)
82
+ return pointers
83
+
84
+ @staticmethod
85
+ def _set_valid(pointers: Iterable[GraphPointer], valid: bool) -> None:
86
+ for pointer in pointers:
87
+ pointer.valid = valid
88
+
89
+ def _parse(self, current_pointers: Pointers, code_point: int) -> Pointers:
90
+ for rule, graph_pointers in self._iterate_over_pointers(current_pointers):
91
+ if is_rule_char(rule):
92
+ valid = any(
93
+ is_point_in_range(code_point, possible) if is_range(possible) else code_point == possible
94
+ for possible in rule["value"]
95
+ )
96
+ self._set_valid(graph_pointers, valid)
97
+ elif is_rule_char_excluded(rule):
98
+ valid = all(
99
+ (not is_point_in_range(code_point, possible)) if is_range(possible) else code_point != possible
100
+ for possible in rule["value"]
101
+ )
102
+ self._set_valid(graph_pointers, valid)
103
+ elif not is_rule_end(rule):
104
+ raise ValueError(f"Unsupported rule: {_stringify(rule)}")
105
+
106
+ # a pointer's id is the sum of its node's id and its parent's id chain.
107
+ # if two pointers share the same id, it means they point to the same node and have identical parent chains.
108
+ # for the purposes of walking the graph, we only need to keep one of them.
109
+ next_pointers = _make_pointers()
110
+ for current_pointer in current_pointers:
111
+ for unresolved_next_pointer in current_pointer.fetch_next():
112
+ for resolved_next_pointer in self._resolve_pointer(unresolved_next_pointer):
113
+ next_pointers.add(resolved_next_pointer)
114
+ return next_pointers
115
+
116
+ def _resolve_pointer(self, unresolved_pointer: GraphPointer) -> Iterator[GraphPointer]:
117
+ for resolved_pointer in unresolved_pointer.resolve():
118
+ if is_rule_ref(resolved_pointer.node.rule):
119
+ raise RuntimeError("Encountered a reference rule when building pointers to the graph")
120
+ if is_rule_end(resolved_pointer.node.rule) and resolved_pointer.parent is not None:
121
+ raise RuntimeError("Encountered an ending rule with a parent when building pointers to the graph")
122
+ yield resolved_pointer
123
+
124
+ def add(self, src: ValidInput, pointers: Pointers | None = None) -> Pointers:
125
+ current = pointers if pointers is not None else self._get_initial_pointers()
126
+ code_points = get_input_as_code_points(src)
127
+ for code_point_pos, code_point in enumerate(code_points):
128
+ current = self._parse(current, code_point)
129
+ if current.size == 0:
130
+ raise InputParseError(code_points, code_point_pos, list(self._previous_code_points))
131
+ self._previous_code_points.extend(code_points)
132
+ return current
133
+
134
+ # generator that yields either the node, or if a reference rule, the referenced node
135
+ # we need these function, as distinct from leveraging the logic in GraphPointer,
136
+ # because that needs a rule ref with already defined nodes; this function is used to _set_ those nodes
137
+ def _fetch_nodes_for_root_node(
138
+ self,
139
+ root_nodes: RootNode,
140
+ parent: GraphPointer | None = None,
141
+ ) -> Iterator[tuple[GraphNode, GraphPointer | None]]:
142
+ for node in root_nodes.values():
143
+ if is_rule_ref(node.rule):
144
+ yield from self._fetch_nodes_for_root_node(
145
+ self._get_root_node(node.rule.value), GraphPointer(node, parent)
146
+ )
147
+ else:
148
+ yield (node, parent)
149
+
150
+ def __repr__(self) -> str:
151
+ return self.print(colors=True)
152
+
153
+ def print(self, *, pointers: Pointers | None = None, colors: bool = False) -> str:
154
+ col = colorize if colors else (lambda s, _color: f"{s}")
155
+ graph_view: list[str] = []
156
+ for root_node in self._roots.values():
157
+ for node in root_node.values():
158
+ graph_view.append(node.print(pointers=pointers, show_position=True, colorize=col))
159
+ return "\n" + "\n".join(graph_view)
160
+
161
+ def _iterate_over_pointers(self, pointers: Pointers) -> Iterator[tuple[UnresolvedRule, list[GraphPointer]]]:
162
+ # rules are grouped by identity: the constructor guarantees identical rules share one object
163
+ seen_rules: dict[int, tuple[UnresolvedRule, list[GraphPointer]]] = {}
164
+ for pointer in pointers:
165
+ rule = pointer.rule
166
+ if is_rule_ref(rule):
167
+ raise RuntimeError("Encountered a reference rule in the graph, this should not happen")
168
+ seen_rule = seen_rules.get(id(rule))
169
+ if seen_rule is None:
170
+ seen_rules[id(rule)] = (rule, [pointer])
171
+ else:
172
+ seen_rule[1].append(pointer)
173
+
174
+ for rule, graph_pointers in seen_rules.values():
175
+ yield (rule, graph_pointers)
176
+
177
+
178
+ def _stringify(value: object) -> str:
179
+ try:
180
+ return json.dumps(value, separators=(",", ":"))
181
+ except TypeError:
182
+ return repr(value)
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/graph_node.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Iterable
4
+ from dataclasses import dataclass
5
+ from typing import TYPE_CHECKING, Generic, TypeVar
6
+
7
+ from .colorize import Colorize, colorize
8
+ from .printer import print_graph_node
9
+ from .types import UnresolvedRule
10
+
11
+ if TYPE_CHECKING:
12
+ from .graph_pointer import GraphPointer
13
+
14
+ R = TypeVar("R", bound=UnresolvedRule)
15
+
16
+
17
+ @dataclass(frozen=True)
18
+ class GraphNodeMeta:
19
+ stack_id: int
20
+ path_id: int
21
+ step_id: int
22
+
23
+
24
+ class GraphNode(Generic[R]):
25
+ rule: R
26
+ next: GraphNode | None
27
+ meta: GraphNodeMeta
28
+
29
+ def __init__(self, rule: R, meta: GraphNodeMeta, next: GraphNode | None = None):
30
+ self.rule = rule
31
+ if meta is None:
32
+ raise TypeError("Meta is undefined")
33
+ self.meta = meta
34
+ self.next = next
35
+ self._id: str | None = None
36
+
37
+ @property
38
+ def id(self) -> str:
39
+ if not self._id:
40
+ self._id = f"{self.meta.stack_id},{self.meta.path_id},{self.meta.step_id}"
41
+ return self._id
42
+
43
+ def print(
44
+ self,
45
+ *,
46
+ colorize: Colorize,
47
+ show_position: bool = False,
48
+ pointers: Iterable[GraphPointer] | None = None,
49
+ ) -> str:
50
+ return print_graph_node(self)(pointers=pointers, show_position=show_position, colorize=colorize)
51
+
52
+ def __repr__(self) -> str:
53
+ return self.print(colorize=colorize, show_position=False)
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/graph_pointer.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Iterator
4
+ from typing import Generic, TypeVar
5
+
6
+ from .colorize import Colorize, colorize
7
+ from .graph_node import GraphNode
8
+ from .printer import print_graph_pointer
9
+ from .type_guards import (
10
+ is_graph_pointer_rule_char,
11
+ is_graph_pointer_rule_char_exclude,
12
+ is_graph_pointer_rule_end,
13
+ is_graph_pointer_rule_ref,
14
+ is_rule_end,
15
+ )
16
+ from .types import UnresolvedRule
17
+
18
+ R = TypeVar("R", bound=UnresolvedRule)
19
+
20
+
21
+ class GraphPointer(Generic[R]):
22
+ node: GraphNode[R]
23
+ parent: GraphPointer | None
24
+
25
+ def __init__(self, node: GraphNode[R], parent: GraphPointer | None = None):
26
+ if node is None:
27
+ raise TypeError("Node is undefined")
28
+ self.node = node
29
+ self.parent = parent
30
+ self._id: str | None = None
31
+ self._valid: bool | None = None
32
+
33
+ @property
34
+ def id(self) -> str:
35
+ """The node id prefixed by the ids of every ancestor: ``"<root>-...-<parent>-<node>"``.
36
+
37
+ Computed lazily and iteratively: the parent chain grows with every
38
+ repetition of a rule, and most pointers created while walking it are
39
+ transient and never need an id.
40
+ """
41
+ if self._id is None:
42
+ chain: list[GraphPointer] = []
43
+ pointer: GraphPointer | None = self
44
+ while pointer is not None and pointer._id is None:
45
+ chain.append(pointer)
46
+ pointer = pointer.parent
47
+ prefix = pointer._id if pointer is not None else None
48
+ for pointer in reversed(chain):
49
+ prefix = pointer._id = f"{prefix}-{pointer.node.id}" if prefix is not None else pointer.node.id
50
+ return self._id # type: ignore[return-value]
51
+
52
+ def resolve(self, resolved: bool = False) -> Iterator[GraphPointer]:
53
+ """
54
+ 1. If the current node is an end node, and the pointer has a parent, return the parent's `fetch_next`; else return nothing.
55
+ 2. If the current node is a rule ref, yield the referenced nodes, _unless_ resolved is true, in which case it returns next.
56
+ 3. If the current node is a char or range, we go to the next node. If none exists, throw an error.
57
+
58
+ Implemented with an explicit stack rather than recursion: resolving an
59
+ end node walks up the parent chain, which is as long as the number of
60
+ rule repetitions seen so far. Pointers are visited depth first, in the
61
+ same order the recursive formulation would yield them.
62
+ """
63
+ stack: list[tuple[GraphPointer, bool]] = [(self, resolved)]
64
+ while stack:
65
+ pointer, resolved = stack.pop()
66
+ if is_graph_pointer_rule_ref(pointer):
67
+ if resolved:
68
+ if pointer.node.next is None:
69
+ raise RuntimeError(f"No next node: {pointer.node!r}")
70
+ stack.append((GraphPointer(pointer.node.next, pointer.parent), False))
71
+ else:
72
+ children = [GraphPointer(node, pointer) for node in pointer.node.rule.nodes] # type: ignore[union-attr]
73
+ stack.extend((child, False) for child in reversed(children))
74
+ elif is_graph_pointer_rule_end(pointer):
75
+ if pointer.parent is None:
76
+ yield pointer
77
+ else:
78
+ stack.append((pointer.parent, True))
79
+ elif is_graph_pointer_rule_char(pointer) or is_graph_pointer_rule_char_exclude(pointer):
80
+ yield pointer
81
+ else:
82
+ raise ValueError(f"Unknown rule: {pointer.node.rule!r}")
83
+
84
+ def fetch_next(self) -> Iterator[GraphPointer]:
85
+ pointer: GraphPointer = self
86
+ while True:
87
+ # if this pointer is invalid, then we don't return any new pointers
88
+ if pointer._valid is False:
89
+ return
90
+
91
+ # if this pointer is an end node, we return the parent's next node. If no parent exists,
92
+ # we return nothing, since it's the end of the line.
93
+ if is_rule_end(pointer.node.rule):
94
+ if pointer.parent is None:
95
+ return
96
+ pointer = pointer.parent
97
+ else:
98
+ if pointer.node.next is None:
99
+ raise RuntimeError(f"No next node: {pointer.node!r}")
100
+ yield from GraphPointer(pointer.node.next, pointer.parent).resolve()
101
+ return
102
+
103
+ @property
104
+ def rule(self) -> R:
105
+ return self.node.rule
106
+
107
+ @property
108
+ def valid(self) -> bool | None:
109
+ return self._valid
110
+
111
+ @valid.setter
112
+ def valid(self, valid: bool) -> None:
113
+ self._valid = valid
114
+
115
+ def print(self, *, colorize: Colorize) -> str:
116
+ return print_graph_pointer(self)(colorize=colorize)
117
+
118
+ def __repr__(self) -> str:
119
+ return self.print(colorize=colorize)
120
+
121
+
122
+ GraphPointerKey = str
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/parse_state.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from collections.abc import Iterable, Iterator
5
+ from typing import TYPE_CHECKING, Any
6
+
7
+ from .types import ResolvedRule, ValidInput
8
+
9
+ if TYPE_CHECKING:
10
+ from .graph import Graph
11
+
12
+
13
+ def _rule_key(rule: Any) -> str:
14
+ try:
15
+ return json.dumps(rule, sort_keys=True, separators=(",", ":"))
16
+ except TypeError:
17
+ return repr(rule)
18
+
19
+
20
+ class ParseState:
21
+ """An immutable view of the rules that may come next in the parsed input.
22
+
23
+ Iterate over it (or call ``rules()``) to get the possible rules. Call
24
+ ``add(input)`` (or the state itself) to parse more input and get a new state.
25
+ """
26
+
27
+ def __init__(self, graph: Graph, pointers: Iterable[Any]):
28
+ self._graph = graph
29
+ self._pointers = pointers
30
+
31
+ def __call__(self, input: ValidInput) -> ParseState:
32
+ return self.add(input)
33
+
34
+ def __iter__(self) -> Iterator[ResolvedRule]:
35
+ yield from self.rules()
36
+
37
+ def rules(self) -> Iterator[ResolvedRule]:
38
+ rules: set[str] = set()
39
+ for pointer in self._pointers:
40
+ rule = pointer.rule
41
+ key = _rule_key(rule)
42
+ if key not in rules:
43
+ rules.add(key)
44
+ yield rule
45
+
46
+ def add(self, input: ValidInput) -> ParseState:
47
+ pointers = self._graph.add(input, self._pointers)
48
+ return ParseState(self._graph, pointers)
49
+
50
+ @property
51
+ def size(self) -> int:
52
+ return len(list(self.rules()))
53
+
54
+ @property
55
+ def grammar(self) -> str:
56
+ return self._graph.grammar
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/printer.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Callable, Iterable
4
+ from typing import TYPE_CHECKING
5
+
6
+ from .colorize import Color, Colorize
7
+ from .get_parent_stack_id import get_parent_stack_id
8
+ from .type_guards import is_range, is_rule_char, is_rule_ref
9
+
10
+ if TYPE_CHECKING:
11
+ from .graph_node import GraphNode
12
+ from .graph_pointer import GraphPointer
13
+
14
+
15
+ def print_graph_pointer(pointer: GraphPointer) -> Callable[..., str]:
16
+ def _print(*, colorize: Colorize) -> str:
17
+ return colorize(f"*{get_parent_stack_id(pointer, colorize)}", Color.RED)
18
+
19
+ return _print
20
+
21
+
22
+ def print_graph_node(node: GraphNode) -> Callable[..., str]:
23
+ def _print(
24
+ *,
25
+ colorize: Colorize,
26
+ pointers: Iterable[GraphPointer] | None = None,
27
+ show_position: bool = False,
28
+ ) -> str:
29
+ col = colorize
30
+ rule = node.rule
31
+
32
+ parts: list[str] = []
33
+ if show_position:
34
+ parts.extend(
35
+ [
36
+ col("{", Color.BLUE),
37
+ col(node.id, Color.GRAY),
38
+ col("}", Color.BLUE),
39
+ ]
40
+ )
41
+ if is_rule_char(rule):
42
+ rendered = "".join(
43
+ # the reference renders a range as its two ends separated by a comma
44
+ ",".join(col(chr(val), Color.YELLOW) for val in v) if is_range(v) else _get_char(v)
45
+ for v in rule["value"]
46
+ )
47
+ parts.extend(
48
+ [
49
+ col("[", Color.GRAY),
50
+ col(rendered, Color.YELLOW),
51
+ col("]", Color.GRAY),
52
+ ]
53
+ )
54
+ elif is_rule_ref(rule):
55
+ parts.append(col("Ref(", Color.GRAY) + col(f"{rule.value}", Color.GREEN) + col(")", Color.GRAY))
56
+ else:
57
+ parts.append(col(rule["type"], Color.YELLOW))
58
+
59
+ if pointers is not None:
60
+ for pointer in pointers:
61
+ pointer_parts: list[str] = []
62
+ if pointer.node is node:
63
+ pointer_parts.append(pointer.print(colorize=col))
64
+ if pointer_parts:
65
+ parts.append(col("[", Color.GRAY))
66
+ parts.extend(pointer_parts)
67
+ parts.append(col("]", Color.GRAY))
68
+
69
+ segments = [
70
+ "".join(parts),
71
+ node.next.print(pointers=pointers, colorize=col, show_position=show_position) if node.next else None,
72
+ ]
73
+ return col("-> ", Color.GRAY).join(segment for segment in segments if segment)
74
+
75
+ return _print
76
+
77
+
78
+ def _get_char(char_code: int) -> str:
79
+ char = chr(char_code)
80
+ if char == "\n":
81
+ return "\\n"
82
+ return char
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/rule_ref.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Iterable
4
+ from typing import TYPE_CHECKING
5
+
6
+ if TYPE_CHECKING:
7
+ from .graph_node import GraphNode
8
+
9
+
10
+ class RuleRef:
11
+ """A reference to another rule, by id. Resolved to concrete nodes by the graph."""
12
+
13
+ value: int
14
+
15
+ def __init__(self, value: int):
16
+ self.value = value
17
+ self._nodes: Iterable[GraphNode] | None = None
18
+
19
+ @property
20
+ def nodes(self) -> Iterable[GraphNode]:
21
+ if self._nodes is None:
22
+ raise RuntimeError("Nodes are not set")
23
+ return self._nodes
24
+
25
+ @nodes.setter
26
+ def nodes(self, nodes: Iterable[GraphNode]) -> None:
27
+ self._nodes = nodes
28
+
29
+ def __eq__(self, other: object) -> bool:
30
+ return isinstance(other, RuleRef) and other.value == self.value
31
+
32
+ def __hash__(self) -> int:
33
+ return hash(("RuleRef", self.value))
34
+
35
+ def __repr__(self) -> str:
36
+ return f"RuleRef({self.value})"
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/type_guards.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeGuard
5
+
6
+ from .rule_ref import RuleRef
7
+ from .types import Range, RuleChar, RuleCharExclude, RuleEnd, RuleType, UnresolvedRule
8
+
9
+ if TYPE_CHECKING:
10
+ from .graph_pointer import GraphPointer
11
+
12
+
13
+ def _get_type(rule: Any) -> Any:
14
+ if isinstance(rule, Mapping):
15
+ return rule.get("type")
16
+ return getattr(rule, "type", None)
17
+
18
+
19
+ def is_rule_type(type_: Any = None) -> TypeGuard[RuleType]:
20
+ return bool(type_) and any(type_ == member.value for member in RuleType)
21
+
22
+
23
+ def is_rule(rule: Any = None) -> TypeGuard[UnresolvedRule]:
24
+ return bool(rule) and isinstance(rule, Mapping) and "type" in rule and is_rule_type(rule["type"])
25
+
26
+
27
+ def is_rule_ref(rule: Any = None) -> TypeGuard[RuleRef]:
28
+ return isinstance(rule, RuleRef)
29
+
30
+
31
+ def is_rule_end(rule: Any = None) -> TypeGuard[RuleEnd]:
32
+ return rule is not None and not is_rule_ref(rule) and _get_type(rule) == RuleType.END
33
+
34
+
35
+ def is_rule_char(rule: Any = None) -> TypeGuard[RuleChar]:
36
+ return rule is not None and not is_rule_ref(rule) and _get_type(rule) == RuleType.CHAR
37
+
38
+
39
+ def is_rule_char_excluded(rule: Any = None) -> TypeGuard[RuleCharExclude]:
40
+ return rule is not None and not is_rule_ref(rule) and _get_type(rule) == RuleType.CHAR_EXCLUDE
41
+
42
+
43
+ def is_range(range_: Any = None) -> TypeGuard[Range]:
44
+ return (
45
+ isinstance(range_, (list, tuple))
46
+ and len(range_) == 2
47
+ and all(isinstance(n, int) and not isinstance(n, bool) for n in range_)
48
+ )
49
+
50
+
51
+ def is_graph_pointer_rule_ref(pointer: GraphPointer) -> bool:
52
+ return is_rule_ref(pointer.rule)
53
+
54
+
55
+ def is_graph_pointer_rule_end(pointer: GraphPointer) -> bool:
56
+ return is_rule_end(pointer.rule)
57
+
58
+
59
+ def is_graph_pointer_rule_char(pointer: GraphPointer) -> bool:
60
+ return is_rule_char(pointer.rule)
61
+
62
+
63
+ def is_graph_pointer_rule_char_exclude(pointer: GraphPointer) -> bool:
64
+ return is_rule_char_excluded(pointer.rule)
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_graph/types.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from enum import StrEnum
4
+ from typing import TYPE_CHECKING, Literal, TypedDict
5
+
6
+ from .rule_ref import RuleRef
7
+
8
+ if TYPE_CHECKING:
9
+ from .generic_set import GenericSet
10
+ from .graph_pointer import GraphPointer
11
+
12
+
13
+ class RuleType(StrEnum):
14
+ CHAR = "char"
15
+ CHAR_EXCLUDE = "char_exclude"
16
+ END = "end"
17
+
18
+
19
+ # A range is a two-element list ``[start, end]`` of inclusive code points.
20
+ Range = list[int]
21
+
22
+
23
+ class RuleChar(TypedDict):
24
+ type: Literal[RuleType.CHAR]
25
+ value: list[int | Range]
26
+
27
+
28
+ class RuleCharExclude(TypedDict):
29
+ type: Literal[RuleType.CHAR_EXCLUDE]
30
+ value: list[int | Range]
31
+
32
+
33
+ class RuleEnd(TypedDict):
34
+ type: Literal[RuleType.END]
35
+
36
+
37
+ UnresolvedRule = RuleChar | RuleCharExclude | RuleRef | RuleEnd
38
+ # RuleRefs should never be exposed to the end user.
39
+ ResolvedRule = RuleCharExclude | RuleChar | RuleEnd
40
+ ResolvedGraphPointer = "GraphPointer"
41
+ Pointers = "GenericSet[GraphPointer, str]"
42
+
43
+ # ValidInput can either be a string, or a number indicating a code point.
44
+ # It CANNOT be a number representing a number; a number being a "number" (like "8")
45
+ # should be passed in as a string.
46
+ ValidInput = str | int | list[int]
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_parser/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from .build_rule_stack import build_rule_stack
2
+
3
+ __all__ = ["build_rule_stack"]
v2-models-effort/runs/20261028-095511-dry-moon/ported_implementation/gbnf/grammar_parser/build_rule_stack.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from ..grammar_graph.rule_ref import RuleRef
4
+ from ..grammar_graph.type_guards import is_range, is_rule_end
5
+ from ..grammar_graph.types import RuleChar, RuleCharExclude, RuleType, UnresolvedRule
6
+ from ..rules_builder.type_guards import (
7
+ is_rule_def_alt,
8
+ is_rule_def_char,
9
+ is_rule_def_char_alt,
10
+ is_rule_def_char_not,
11
+ is_rule_def_char_rng_upper,
12
+ is_rule_def_end,
13
+ is_rule_def_ref,
14
+ )
15
+ from ..rules_builder.types import InternalRuleDef, InternalRuleDefChar, InternalRuleDefCharNot
16
+
17
+
18
+ def _make_char_rule(rule_def: InternalRuleDefChar | InternalRuleDefCharNot) -> RuleChar | RuleCharExclude:
19
+ return { # type: ignore[return-value]
20
+ "type": RuleType.CHAR_EXCLUDE if is_rule_def_char_not(rule_def) else RuleType.CHAR,
21
+ "value": list(rule_def["value"]),
22
+ }
23
+
24
+
25
+ def build_rule_stack(linear_rules: list[InternalRuleDef]) -> list[list[UnresolvedRule]]:
26
+ paths: list[UnresolvedRule] = []
27
+
28
+ stack: list[list[UnresolvedRule]] = []
29
+
30
+ total = len(linear_rules)
31
+ idx = 0
32
+ while idx < total:
33
+ rule_def = linear_rules[idx]
34
+ if is_rule_def_char(rule_def) or is_rule_def_char_not(rule_def):
35
+ # this could be a single char, or a range, or a sequence of alts; we don't know until we step through it.
36
+ char_rule = _make_char_rule(rule_def)
37
+ idx += 1
38
+ rule = linear_rules[idx] if idx < total else None
39
+ while idx < total and (is_rule_def_char_rng_upper(rule) or is_rule_def_char_alt(rule)):
40
+ if is_rule_def_char_rng_upper(rule):
41
+ # previous rule value should be a number
42
+ prev_value = char_rule["value"].pop() if char_rule["value"] else None
43
+ if is_range(prev_value):
44
+ raise ValueError(f"Unexpected range, expected a number but got an array: {prev_value}")
45
+ if prev_value is None:
46
+ raise ValueError("Unexpected undefined value")
47
+ char_rule["value"].append([prev_value, rule["value"]])
48
+ if is_rule_def_char_alt(rule):
49
+ char_rule["value"].append(rule["value"])
50
+ idx += 1
51
+ rule = linear_rules[idx] if idx < total else None
52
+ paths.append(char_rule)
53
+ else:
54
+ if is_rule_def_alt(rule_def):
55
+ if not paths:
56
+ raise ValueError("Encountered alt without anything before it")
57
+ paths.append({"type": RuleType.END})
58
+ stack.append(paths)
59
+ paths = []
60
+ elif is_rule_def_end(rule_def):
61
+ paths.append({"type": RuleType.END})
62
+ elif is_rule_def_ref(rule_def):
63
+ paths.append(RuleRef(rule_def["value"]))
64
+ elif is_rule_def_char_alt(rule_def):
65
+ raise ValueError(f"Encountered char alt, should be handled by above block: {rule_def['type']}")
66
+ else:
67
+ raise ValueError(f"Unsupported rule type: {rule_def['type']}")
68
+ idx += 1
69
+
70
+ if not is_rule_end(paths[-1] if paths else None):
71
+ paths.append({"type": RuleType.END})
72
+
73
+ stack.append(paths)
74
+
75
+ return stack