diff --git a/grammar.js b/grammar.js index 410a610..2cf1d0e 100644 --- a/grammar.js +++ b/grammar.js @@ -153,7 +153,14 @@ module.exports = grammar({ time_predicate: $ => time_predicate, - time_interval: $ => token(seq(time_predicate, "-", time_predicate)), + time_interval: $ => + token( + seq( + alias(time_predicate, $.time_predicate), + "-", + alias(time_predicate, $.time_predicate), + ), + ), regexp: $ => seq( diff --git a/src/grammar.json b/src/grammar.json index d09432c..965c6d0 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -819,896 +819,906 @@ "type": "SEQ", "members": [ { - "type": "TOKEN", + "type": "ALIAS", "content": { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] + "type": "TOKEN", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" + ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + }, + { + "type": "PATTERN", + "value": "[\\d]+" + } + ] } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + } + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] + } }, { - "type": "STRING", - "value": "h" + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] + } }, { - "type": "PATTERN", - "value": "[\\d]+" + "type": "BLANK" } ] - } - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } }, { - "type": "STRING", - "value": "w" + "type": "BLANK" } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "h" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "m" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "s" - } - ] + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" + ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] } - ] - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + ] + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } }, { - "type": "STRING", - "value": "h" + "type": "BLANK" } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "m" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "s" - } - ] - } - }, - { - "type": "BLANK" - } - ] - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "h" - } - ] + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" + ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } }, { - "type": "STRING", - "value": "m" + "type": "BLANK" } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "s" - } - ] - } - }, - { - "type": "BLANK" - } - ] - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "h" - } - ] + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "m" - } - ] + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + ] + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] + } }, { - "type": "STRING", - "value": "s" + "type": "BLANK" } ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } } - } - ] + ] + } } - } - ] - } + ] + } + }, + "named": true, + "value": "time_predicate" }, { "type": "STRING", "value": "-" }, { - "type": "TOKEN", + "type": "ALIAS", "content": { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] + "type": "TOKEN", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" + ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + }, + { + "type": "PATTERN", + "value": "[\\d]+" + } + ] } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + } + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] + } }, { - "type": "STRING", - "value": "h" + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] + } }, { - "type": "PATTERN", - "value": "[\\d]+" + "type": "BLANK" } ] - } - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } }, { - "type": "STRING", - "value": "w" + "type": "BLANK" } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "h" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "m" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "s" - } - ] + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" + ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] } - ] - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + ] + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } }, { - "type": "STRING", - "value": "h" + "type": "BLANK" } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "m" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "s" - } - ] - } - }, - { - "type": "BLANK" - } - ] - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "h" - } - ] + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" + ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } }, { - "type": "STRING", - "value": "m" + "type": "BLANK" } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "s" - } - ] - } - }, - { - "type": "BLANK" - } - ] - } - ] - } - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "w" - } - ] - } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "h" - } - ] + ] + } + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "w" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "TOKEN", - "content": { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[\\d]+" - }, - { - "type": "STRING", - "value": "m" - } - ] + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "h" + } + ] + } + }, + { + "type": "BLANK" } - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "TOKEN", - "content": { - "type": "SEQ", + ] + }, + { + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[\\d]+" + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "m" + } + ] + } }, { - "type": "STRING", - "value": "s" + "type": "BLANK" } ] + }, + { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[\\d]+" + }, + { + "type": "STRING", + "value": "s" + } + ] + } } - } - ] + ] + } } - } - ] - } + ] + } + }, + "named": true, + "value": "time_predicate" } ] } diff --git a/src/scanner.cc b/src/scanner.cc index 724c107..ebede2e 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -259,7 +259,9 @@ bool tree_sitter_liquidsoap_external_scanner_scan(void *payload, TSLexer *lexer, } if (parser_decorator != L"json.parse" && - parser_decorator != L"yaml.parse") { + parser_decorator != L"yaml.parse" && + parser_decorator != L"sqlite.row" && + parser_decorator != L"sqlite.query") { END_STATE(); }