Compare commits

...

3 Commits

Author SHA1 Message Date
Peter J. Holzer 12dcf05eaf Merge branch 'master' of git.hjp.at:hjp/procrusql 2024-12-12 21:51:30 +01:00
Peter J. Holzer 43272bb96a Add schema support for data rules 2024-12-12 21:51:05 +01:00
Peter J. Holzer d31204cd5c Add view definitions 2024-12-12 21:50:25 +01:00
1 changed files with 16 additions and 1 deletions

View File

@ -79,7 +79,8 @@ def parse_ruleset(ps):
ps3 = parse_table_rule(ps2) or \
parse_column_rule(ps2) or \
parse_data_rule(ps2) or \
parse_index_rule(ps2)
parse_index_rule(ps2) or \
parse_view_rule(ps2)
if ps3:
ps2.ast.append(ps3.ast)
ps2.position = ps3.position
@ -273,6 +274,20 @@ def parse_index_rule(ps):
return ps2
def parse_view_rule(ps):
ps2 = ps.clone()
ps2.skip_whitespace_and_comments()
if not ps2.match(r"view\b"):
ps.record_child_failure(ps2, "expected “view”")
return
ps2.skip_whitespace_and_comments()
ps3 = parse_table_name(ps2)
if not ps3:
ps.record_child_failure(ps2, "expected view name")
return
ps2.skip_whitespace_and_comments()
ps3 = parse_multiline_string(ps2)
def parse_table_name(ps):