Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguish 'single'- and "double"-quoted tokens in CREATE GENERATOR. #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ generator_schema(many) ::= generator_schema(ss) T_COMMA generator_schemum(s).
generator_schemum(empty) ::= .
generator_schemum(nonempty) ::= generator_schemum(s) gs_token(t).
gs_token(comp) ::= T_LROUND generator_schemum(s) T_RROUND.
gs_token(name) ::= L_NAME(n).
gs_token(string) ::= L_STRING(s).
gs_token(prim) ::= ANY(t).

/*
Expand Down
4 changes: 3 additions & 1 deletion src/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ def p_generator_schema_one(self, s): return [s]
def p_generator_schema_many(self, ss, s): ss.append(s); return ss
def p_generator_schemum_empty(self): return []
def p_generator_schemum_nonempty(self, s, t): s.append(t); return s
def p_gs_token_prim(self, t): return t
def p_gs_token_comp(self, s): return s
def p_gs_token_name(self, n): return n
def p_gs_token_string(self, s): return ('string', s)
def p_gs_token_prim(self, t): return t

def p_stattype_s(self, name):
return name
Expand Down
6 changes: 6 additions & 0 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,12 @@ def test_trivial_commands():
['pqr', 'categorical'],
['lmn', 'cyclic'],
])]
assert parse_bql_string('create generator t_cc for t using crosscat'
'''("numerical" "nume""rical", 'qua''gga' categorical)''') == \
[ast.CreateGen(False, 't_cc', False, 't', 'crosscat', [
['numerical', 'nume"rical'],
[('string', "qua'gga"), 'categorical'],
])]
assert parse_bql_string('initialize 1 model for t;') == \
[ast.InitModels(False, 't', 1, None)]
assert parse_bql_string('initialize 1 model if not exists for t;') == \
Expand Down