@@ -1188,7 +1188,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
11881188
11891189"""llama.cpp gbnf rules from vendor/llama.cpp/grammars"""
11901190
1191- ARITHMETIC_GBNF = """\
1191+ ARITHMETIC_GBNF = r """
11921192root ::= (expr "=" ws term "\n")+
11931193expr ::= term ([-+*/] term)*
11941194term ::= ident | num | "(" ws expr ")" ws
@@ -1197,7 +1197,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
11971197ws ::= [ \t\n]*
11981198"""
11991199
1200- C_GBNF = """\
1200+ C_GBNF = r """
12011201root ::= (declaration)*
12021202
12031203declaration ::= dataType identifier "(" parameter? ")" "{" statement* "}"
@@ -1242,7 +1242,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
12421242ws ::= ([ \t\n]+)
12431243"""
12441244
1245- CHESS_GBNF = """\
1245+ CHESS_GBNF = r """
12461246root ::= object
12471247value ::= object | array | string | number | ("true" | "false" | "null") ws
12481248
@@ -1270,7 +1270,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
12701270ws ::= ([ \t\n] ws)?
12711271"""
12721272
1273- JAPANESE_GBNF = """\
1273+ JAPANESE_GBNF = r """
12741274root ::= object
12751275value ::= object | array | string | number | ("true" | "false" | "null") ws
12761276
@@ -1298,7 +1298,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
12981298ws ::= ([ \t\n] ws)?
12991299"""
13001300
1301- JSON_ARR_GBNF = """\
1301+ JSON_ARR_GBNF = r """
13021302# This is the same as json.gbnf but we restrict whitespaces at the end of the root array
13031303# Useful for generating JSON arrays
13041304
@@ -1336,7 +1336,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
13361336"""
13371337
13381338
1339- JSON_GBNF = """\
1339+ JSON_GBNF = r """
13401340root ::= object
13411341value ::= object | array | string | number | ("true" | "false" | "null") ws
13421342
@@ -1360,10 +1360,10 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
13601360
13611361number ::= ("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? ws
13621362
1363- # Optional space: by convention, applied in this grammar after literal chars when allowed
1364- ws ::= ([ \t \n ] ws)? """
1363+ ws ::= ([ \t\n] ws)?
1364+ """
13651365
1366- LIST_GBNF = """\
1366+ LIST_GBNF = r """
13671367root ::= item+
13681368
13691369# Excludes various line break characters
0 commit comments