Skip to content

Commit a48f466

Browse files
authored
Merge branch 'master' into wip/repeat_pattern
2 parents 2d2e89f + 5e1fcd9 commit a48f466

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description = "scala grammar for the tree-sitter parsing library"
44
version = "0.20.0"
55
keywords = ["incremental", "parsing", "scala"]
66
categories = ["parsing", "text-editors"]
7-
repository = "https://github.com/tree-sitter/tree-sitter-javascript"
7+
repository = "https://github.com/tree-sitter/tree-sitter-scala"
88
edition = "2018"
99
license = "MIT"
1010

corpus/expressions.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ Call expressions (Scala 3 syntax)
9595

9696
class C {
9797
a(b, c)(using A.B)
98+
99+
foo(new A:
100+
def a = new B:
101+
def b = 1)
98102
}
99103

100104
--------------------------------------------------------------------------------
@@ -112,7 +116,21 @@ class C {
112116
(arguments
113117
(field_expression
114118
(identifier)
115-
(identifier)))))))
119+
(identifier))))
120+
(call_expression
121+
(identifier)
122+
(arguments
123+
(instance_expression
124+
(type_identifier)
125+
(template_body
126+
(function_definition
127+
(identifier)
128+
(instance_expression
129+
(type_identifier)
130+
(template_body
131+
(function_definition
132+
(identifier)
133+
(integer_literal))))))))))))
116134

117135
================================================================================
118136
SIP-44 Fewer braces (Scala 3 syntax)

corpus/types.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ type G = H[A1] {
198198
def foo[A2 <: Stepper[_]]: A2
199199
}
200200

201+
type I = F1[A1:
202+
def foo: A2]
203+
201204
--------------------------------------------------------------------------------
202205

203206
(compilation_unit
@@ -235,7 +238,18 @@ type G = H[A1] {
235238
(type_identifier)
236239
(type_arguments
237240
(wildcard)))))
238-
(type_identifier))))))
241+
(type_identifier)))))
242+
(type_definition
243+
(type_identifier)
244+
(generic_type
245+
(type_identifier)
246+
(type_arguments
247+
(compound_type
248+
(type_identifier)
249+
(refinement
250+
(function_declaration
251+
(identifier)
252+
(type_identifier))))))))
239253

240254
================================================================================
241255
Infix types

script/smoke_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
SCALA_SCALA_LIBRARY_EXPECTED=95
66
SCALA_SCALA_COMPILER_EXPECTED=87
7-
DOTTY_COMPILER_EXPECTED=81
7+
DOTTY_COMPILER_EXPECTED=82
88
SYNTAX_COMPLEXITY_CEILING=2500
99

1010
if [ ! -d "$SCALA_SCALA_DIR" ]; then

src/scanner.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ bool tree_sitter_scala_external_scanner_scan(void *payload, TSLexer *lexer,
9999

100100
// Before advancing the lexer, check if we can double outdent
101101
if (valid_symbols[OUTDENT] &&
102-
(lexer->lookahead == 0 || (
102+
(lexer->lookahead == 0 ||
103+
(
104+
(prev != -1) &&
105+
lexer->lookahead == ')' ||
106+
lexer->lookahead == ']'
107+
) || (
103108
stack->last_indentation_size != -1 &&
104109
prev != -1 &&
105110
stack->last_indentation_size < prev))) {

0 commit comments

Comments
 (0)