fix whitespace errors
This commit is contained in:
parent
834d423edf
commit
9e77f42ef7
3 changed files with 6 additions and 7 deletions
|
@ -265,7 +265,7 @@ namespace grammar_parser {
|
|||
const uint16_t * print_rule(
|
||||
FILE * file,
|
||||
const uint16_t * base,
|
||||
const uint16_t * src,
|
||||
const uint16_t * src,
|
||||
const std::map<uint16_t, std::string> & symbol_id_names) {
|
||||
uint16_t rule_id = *src;
|
||||
fprintf(file, "<%zu>%s ::= ", src - base, symbol_id_names.at(rule_id).c_str());
|
||||
|
@ -312,4 +312,3 @@ namespace grammar_parser {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ int main(int argc, char ** argv) {
|
|||
fprintf(stderr, "\n\n");
|
||||
|
||||
grammar_parser::parse_state parsed_grammar;
|
||||
llama_grammar * grammar = NULL;
|
||||
llama_grammar * grammar = NULL;
|
||||
if (!params.grammar.empty()) {
|
||||
parsed_grammar = grammar_parser::parse(params.grammar.c_str());
|
||||
fprintf(stderr, "%s: grammar:\n", __func__);
|
||||
|
|
|
@ -1843,7 +1843,7 @@ static void llama_grammar_advance_stack(
|
|||
}
|
||||
|
||||
const uint16_t * pos = stack.back();
|
||||
|
||||
|
||||
if (*pos == 1) {
|
||||
// rule reference, apply rule to stack
|
||||
const uint16_t * subpos = rules[pos[1]] + 1;
|
||||
|
@ -1871,7 +1871,7 @@ static void llama_grammar_advance_stack(
|
|||
// takes a set of possible pushdown stacks on a grammar, which are required to
|
||||
// be positioned at a character range (see `llama_grammar_advance_stack`), and
|
||||
// produces the N possible stacks if the given char is accepted at those
|
||||
// positions
|
||||
// positions
|
||||
static std::vector<std::vector<const uint16_t *>> llama_grammar_accept(
|
||||
const std::vector<const uint16_t *> & rules,
|
||||
const std::vector<std::vector<const uint16_t *>> & stacks,
|
||||
|
@ -1913,7 +1913,7 @@ static std::vector<std::vector<const uint16_t *>> llama_grammar_accept(
|
|||
return new_stacks;
|
||||
}
|
||||
|
||||
// returns `true` if one of the pushdown stacks can accept the given char.
|
||||
// returns `true` if one of the pushdown stacks can accept the given char.
|
||||
static bool llama_grammar_peek(
|
||||
const std::vector<std::vector<const uint16_t *>> & stacks,
|
||||
const uint16_t chr) {
|
||||
|
@ -1942,7 +1942,7 @@ static bool llama_grammar_peek(
|
|||
|
||||
//
|
||||
// grammar - external
|
||||
//
|
||||
//
|
||||
|
||||
struct llama_grammar * llama_grammar_init(const uint16_t * src, uint16_t start_rule_id) {
|
||||
const uint16_t * pos = src;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue