Skip to content

Commit

Permalink
improve scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
Nsidorenco committed Sep 8, 2024
1 parent 860461d commit da9ac22
Show file tree
Hide file tree
Showing 11 changed files with 1,010,028 additions and 827,465 deletions.
14 changes: 14 additions & 0 deletions common/scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum TokenType {
STRUCT,
INTERFACE,
END,
AND,
TRIPLE_QUOTE_CONTENT,
BLOCK_COMMENT_CONTENT,
INSIDE_STRING,
Expand Down Expand Up @@ -410,6 +411,19 @@ static bool scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
}
}
}
} else if (lexer->lookahead == 'a' && valid_symbols[AND]) {
advance(lexer);
if (lexer->lookahead == 'n') {
advance(lexer);
if (lexer->lookahead == 'd') {
advance(lexer);
if (lexer->lookahead == ' ') {
lexer->result_symbol = AND;
lexer->mark_end(lexer);
return true;
}
}
}
} else if (lexer->lookahead == 'e' &&
(valid_symbols[ELSE] || valid_symbols[ELIF] ||
valid_symbols[END] || valid_symbols[DEDENT])) {
Expand Down
16 changes: 13 additions & 3 deletions fsharp/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module.exports = grammar({
$._struct_begin,
$._interface_begin,
"end",
"and",
$._triple_quoted_content,
$.block_comment_content,
$._inside_string_marker,
Expand Down Expand Up @@ -1499,8 +1500,14 @@ module.exports = grammar({
seq("=", $._expression_block),
seq(
"with",
$._property_accessors,
repeat(seq("and", $._property_accessors)),
scoped(
seq(
$._property_accessors,
repeat(seq("and", $._property_accessors)),
),
$._indent,
$._dedent,
),
),
),
),
Expand Down Expand Up @@ -1535,7 +1542,10 @@ module.exports = grammar({
choice(
$._method_defn,
$._property_defn,
seq("with", $._function_or_value_defns),
seq(
"with",
scoped($._function_or_value_defns, $._indent, $._dedent),
),
),
),
),
Expand Down
Loading

0 comments on commit da9ac22

Please sign in to comment.