Skip to content
Merged
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: 1 addition & 1 deletion CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 26 additions & 14 deletions bindings/python/tree_sitter_objectscript/queries/injections.scm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/rust-playground/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/rust-routine/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/common.mak
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(error Windows is not supported)
endif

HOMEPAGE_URL := https://github.com/intersystems/tree-sitter-objectscript
VERSION := 1.9.14
VERSION := 1.9.16

# repository
SRC_DIR := src
Expand Down
1 change: 1 addition & 0 deletions common/keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ module.exports = {
seq('{', $.expression, '}'),
alias($.string_literal, $.typename),
alias($._base_variable, $.typename),
alias($.numeric_literal, $.typename),
),
),
seq(/SqlColumnNumber/i, '=', $.numeric_literal),
Expand Down
28 changes: 25 additions & 3 deletions common/scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ struct ObjectScript_Core_Scanner {
int32_t js_marker_buffer_reversed[MARKER_BUFFER_MAX_LEN];
int js_marker_buffer_reversed_len;
bool is_rtn_dot;
// Allows nested old-style commands to close before the same `. }` line
// is emitted as a dotted block end.
bool pending_dotted_block_end;
};

static inline bool is_label_char(int32_t c) {
Expand Down Expand Up @@ -542,6 +545,15 @@ ObjectScript_Core_Scanner_scan(struct ObjectScript_Core_Scanner *scanner,
if (valid_symbols[SENTINEL]) {
return false;
}

if (scanner->pending_dotted_block_end) {
if (lexer->lookahead == '.' && valid_symbols[_TERMINATION]) {
lexer->mark_end(lexer);
lexer->result_symbol = _TERMINATION;
return true;
}
scanner->pending_dotted_block_end = false;
}
scanner-> is_rtn_dot = false;

// this parses any line that ends in ##continue for
Expand Down Expand Up @@ -1099,11 +1111,18 @@ ObjectScript_Core_Scanner_scan(struct ObjectScript_Core_Scanner *scanner,
advance(lexer);
}
if (lexer->lookahead == '}') {
if (valid_symbols[_TERMINATION]) {
scanner->pending_dotted_block_end = true;
lexer->result_symbol = _TERMINATION;
return true;
}
lexer->result_symbol = _BOL_BLOCK;
scanner->pending_dotted_block_end = false;
scanner->terminated_newline = false;
return true;
}
lexer->result_symbol = _BOL;
scanner->pending_dotted_block_end = false;
scanner->terminated_newline = false;
return true;
}
Expand All @@ -1112,9 +1131,10 @@ ObjectScript_Core_Scanner_scan(struct ObjectScript_Core_Scanner *scanner,
while (lexer->lookahead == ' ' || lexer->lookahead == '\t') advance(lexer);

if (lexer->lookahead == '.') {
lexer->result_symbol = _BOL;
scanner->terminated_newline = false;
return true;
lexer->result_symbol = _BOL;
scanner->pending_dotted_block_end = false;
scanner->terminated_newline = false;
return true;
}
else {
lexer->mark_end(lexer);
Expand Down Expand Up @@ -1342,6 +1362,7 @@ ObjectScript_Core_Scanner_scan(struct ObjectScript_Core_Scanner *scanner,
}
lexer->mark_end(lexer);
lexer->result_symbol = BOL_EXTRA;
scanner->pending_dotted_block_end = false;
scanner->terminated_newline = false;
return true;
}
Expand All @@ -1361,4 +1382,5 @@ static void ObjectScript_Core_Scanner_init(struct ObjectScript_Core_Scanner *sca
scanner->special_pound_if_mode = false;
scanner->special_pound_if_mode_if_depth = 0;
scanner->is_rtn_dot = false;
scanner->pending_dotted_block_end = false;
}
Loading
Loading