~ahelwer/tree-sitter-tlaplus

c5fae9e4ad9f483fb6232a8688a2c940be6b496b — Andrew Helwer 7 months ago d99cb5c
Fixed interaction between :> and jlists (#88)

Bug reported by @will62794 
4 files changed, 36 insertions(+), 2 deletions(-)

M Cargo.toml
M package.json
M src/scanner.cc
M test/corpus/operators.txt
M Cargo.toml => Cargo.toml +1 -1
@@ 1,7 1,7 @@
[package]
name = "tree-sitter-tlaplus"
description = "A tree-sitter grammar for TLA⁺ and PlusCal"
version = "1.0.6"
version = "1.0.7"
authors = ["Andrew Helwer", "Vasiliy Morkovkin"]
license = "MIT"
readme = "README.md"

M package.json => package.json +1 -1
@@ 1,6 1,6 @@
{
  "name": "@tlaplus/tree-sitter-tlaplus",
  "version": "1.0.6",
  "version": "1.0.7",
  "description": "A tree-sitter grammar for TLA⁺ and PlusCal",
  "main": "bindings/node",
  "scripts": {

M src/scanner.cc => src/scanner.cc +1 -0
@@ 468,6 468,7 @@ namespace {
        ACCEPT_LEXEME(Lexeme_COLON);
        if (':' == lookahead) ADVANCE(LexState_OTHER);
        if ('=' == lookahead) ADVANCE(LexState_OTHER);
        if ('>' == lookahead) ADVANCE(LexState_OTHER);
        END_LEX_STATE();
      case LexState_SEMICOLON:
        ACCEPT_LEXEME(Lexeme_SEMICOLON);

M test/corpus/operators.txt => test/corpus/operators.txt +33 -0
@@ 70,6 70,39 @@ op == - 1 - 2
  )
(double_line)))

=============|||
Operators with Colon Prefixes & Jlists
=============|||

---- MODULE Test ----
op ==
  /\ A :> B
  /\ A := B
  /\ A ::= B
  /\ A :: B
  /\ A
====

--------------|||

(source_file (module (header_line) (identifier) (header_line)
  (operator_definition (identifier) (def_eq)
    (conj_list
      (conj_item (bullet_conj)
        (bound_infix_op (identifier_ref) (map_to) (identifier_ref))
      )
      (conj_item (bullet_conj)
        (bound_infix_op (identifier_ref) (assign) (identifier_ref))
      )
      (conj_item (bullet_conj)
        (bound_infix_op (identifier_ref) (bnf_rule) (identifier_ref))
      )
      (conj_item (bullet_conj)
        (label (identifier) (label_as) (identifier_ref))
      )
      (conj_item (bullet_conj) (identifier_ref))
    )
  )
(double_line)))