Skip to content

Commit 65a4ee3

Browse files
committed
Support comma separated import declarations
1 parent c92323d commit 65a4ee3

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

corpus/definitions.txt

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ Imports
3737
================================
3838

3939
import PartialFunction.condOpt
40+
import a.b, c.e
4041
import reflect.io.{Directory, File, Path}
41-
import tools.nsc.classpath._
42-
import lang.System.{lineSeparator => EOL}
4342

4443
---
4544

@@ -48,10 +47,33 @@ import lang.System.{lineSeparator => EOL}
4847
(stable_identifier (identifier) (identifier)))
4948
(import_declaration
5049
(stable_identifier (identifier) (identifier))
51-
(import_selectors (identifier) (identifier) (identifier)))
50+
(stable_identifier (identifier) (identifier)))
51+
(import_declaration
52+
(stable_identifier (identifier) (identifier))
53+
(import_selectors (identifier) (identifier) (identifier))))
54+
55+
================================
56+
Imports: Wildcard
57+
================================
58+
59+
import tools.nsc.classpath._
60+
61+
---
62+
63+
(compilation_unit
5264
(import_declaration
5365
(stable_identifier (stable_identifier (identifier) (identifier)) (identifier))
54-
(wildcard))
66+
(wildcard)))
67+
68+
================================
69+
Imports: Rename
70+
================================
71+
72+
import lang.System.{lineSeparator => EOL}
73+
74+
---
75+
76+
(compilation_unit
5577
(import_declaration
5678
(stable_identifier (identifier) (identifier))
5779
(import_selectors (renamed_identifier (identifier) (identifier)))))

grammar.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ module.exports = grammar({
7575

7676
import_declaration: $ => seq(
7777
'import',
78+
sep1(',', $._import_expression)
79+
),
80+
81+
_import_expression: $ => seq(
7882
choice($.stable_identifier, $.identifier),
7983
optional(seq(
8084
'.',

0 commit comments

Comments
 (0)