Changeset: 2c98f7a982ef for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c98f7a982ef
Modified Files:
testing/mktest.py
Branch: mtest
Log Message:
Recognize MAL functions.
diffs (47 lines):
diff --git a/testing/mktest.py b/testing/mktest.py
--- a/testing/mktest.py
+++ b/testing/mktest.py
@@ -54,12 +54,24 @@ else:
query = []
def is_psm_stmt(stmt:str):
- rgx = re.compile(r'(create|create\s+or\s+replace)\s+(function|procedure)',
re.I)
- return rgx.match(stmt) is not None
+ if opts.language == 'sql':
+ rgx =
re.compile(r'(create|create\s+or\s+replace)\s+(function|procedure)', re.I)
+ return rgx.match(stmt) is not None
+ else:
+ return re.match(r'\s*function\s', stmt) is not None
+
+def is_psm_stmt_end(stmt:str):
+ if opts.language == 'sql':
+ return re.search(r'end;$', stmt, re.I) is not None
+ else:
+ return re.match(r'\s*end(\s+\w+)?\s*;', stmt) is not None
def is_complete_psm_stmt(stmt:str):
- rgx =
re.compile(r'(create|create\s+or\s+replace)\s+(function|procedure)[\S\s]*(end;|external\s+name\s+.*;)$',
re.I)
- return rgx.match(stmt) is not None
+ if opts.language == 'sql':
+ rgx =
re.compile(r'(create|create\s+or\s+replace)\s+(function|procedure)[\S\s]*(end;|external\s+name\s+.*;)$',
re.I)
+ return rgx.match(stmt) is not None
+ else:
+ return re.match(r'\s*function\s.*\bend(\s+\w+)?\s*;', stmt, re.DOTALL)
is not None
def is_copyfrom_stmt(stmt:str):
# TODO fix need stronger regex
@@ -214,9 +226,12 @@ while True:
query = []
continue
# when copyfrom stmt from stdin skip because data may contain --
- if '--' in line and not is_copyfrom_stmt('\n'.join(query)):
+ if opts.language == 'sql' and '--' in line and not
is_copyfrom_stmt('\n'.join(query)):
line = line[:line.index('--')].rstrip()
- if (inpsm and (line.endswith('end;') or line.endswith('END;'))) or (not
inpsm and line.endswith(';')):
+ res = re.match('[^\'"]*((\'[^\']*\'|"[^"]*")[^\'"]*)*#', line)
+ if res is not None:
+ line = res.group(0)[:-1].rstrip()
+ if (inpsm and is_psm_stmt_end(line)) or (not inpsm and line.endswith(';')):
inpsm = False
tmp = ([] + query)
tmp.append(line)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list