json: nit fixes
This commit is contained in:
parent
6165c55d3a
commit
bed826fa56
6 changed files with 8 additions and 8 deletions
2
Makefile
2
Makefile
|
@ -656,7 +656,7 @@ grammar-parser.o: common/grammar-parser.cpp common/grammar-parser.h
|
|||
|
||||
json-schema-to-grammar.o: examples/server/json-schema-to-grammar.cpp examples/server/json-schema-to-grammar.h
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
# $(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<) -DLLAMA_BUILD_JSON_SCHEMA_CONVERTER=1
|
||||
# $(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<) -DLLAMA_BUILD_JSON_SCHEMA_CONVERTER=1
|
||||
# $(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
|
||||
|
||||
train.o: common/train.cpp common/train.h
|
||||
|
|
|
@ -461,7 +461,7 @@ class SchemaConverter:
|
|||
rule += ' )'
|
||||
rule += ' )?'
|
||||
|
||||
rule += ' "}" space '
|
||||
rule += ' "}" space'
|
||||
|
||||
return rule
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ add_executable(${TARGET}
|
|||
server.cpp
|
||||
utils.hpp
|
||||
json.hpp
|
||||
httplib.h
|
||||
httplib.h
|
||||
json-schema-to-grammar.cpp
|
||||
json-schema-to-grammar.h
|
||||
)
|
||||
|
|
|
@ -445,7 +445,7 @@ private:
|
|||
rule += " )?";
|
||||
}
|
||||
|
||||
rule += " \"}\" space ";
|
||||
rule += " \"}\" space";
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
|
|
@ -489,7 +489,7 @@ export class SchemaConverter {
|
|||
rule += ' )?';
|
||||
}
|
||||
|
||||
rule += ' "}" space ';
|
||||
rule += ' "}" space';
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
|
|
@ -57,14 +57,14 @@ struct TestCase {
|
|||
static void run_py(const TestCase& tc) {
|
||||
cerr << "# Running Python " << tc.name.c_str() << endl;
|
||||
tc.prepare();
|
||||
std::system(("python ./examples/json-schema-to-grammar.py " + INPUT_NAME + " > " + OUT_NAME).c_str());
|
||||
assert(std::system(("python ./examples/json-schema-to-grammar.py " + INPUT_NAME + " > " + OUT_NAME).c_str()) == 0);
|
||||
tc.read_and_verify("Python");
|
||||
}
|
||||
|
||||
static void run_mjs(const TestCase& tc) {
|
||||
cerr << "# Running MJS " << tc.name.c_str() << endl;
|
||||
tc.prepare();
|
||||
std::system(("node ./tests/run-json-schema-to-grammar.mjs " + INPUT_NAME + " > " + OUT_NAME).c_str());
|
||||
assert(std::system(("node ./tests/run-json-schema-to-grammar.mjs " + INPUT_NAME + " > " + OUT_NAME).c_str()) == 0);
|
||||
tc.read_and_verify("JavaScript");
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ int main() {
|
|||
e-additionalProperties-value-item ::= "[" space string "," space number "]" space
|
||||
e-kv ::= "\"e\"" space ":" space e
|
||||
number ::= ("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? space
|
||||
root ::= "{" space a-kv "," space b-kv ( "," space ( c-kv c-rest | d-kv d-rest | e-kv ) )? "}" space
|
||||
root ::= "{" space a-kv "," space b-kv ( "," space ( c-kv c-rest | d-kv d-rest | e-kv ) )? "}" space
|
||||
space ::= " "?
|
||||
string ::= "\"" (
|
||||
[^"\\] |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue