tweaks to make closer to real parser, checked in as reference
This commit is contained in:
parent
bd6ecaee2c
commit
2aa998b6a5
1305
GroovyParser.g4
Normal file
1305
GroovyParser.g4
Normal file
File diff suppressed because it is too large
Load Diff
72
grammar.js
72
grammar.js
@ -1,64 +1,68 @@
|
|||||||
module.exports = grammar({
|
module.exports = grammar({
|
||||||
name: 'Groovy',
|
name: 'Groovy',
|
||||||
|
conflicts: $ => [
|
||||||
|
[$.qualified_name]
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
// TODO: add the actual grammar rules
|
// TODO: add the actual grammar rules
|
||||||
source_file: $ => seq(
|
source_file: $ => seq(
|
||||||
optional($._shebang_comment),
|
optional($._shebang_comment),
|
||||||
optional(seq($.package_definition, repeat($._nl_semicolon))),
|
optional(seq($.package_declaration, repeat($._sep))),
|
||||||
repeat(
|
optional($._script_statements)
|
||||||
choice(
|
|
||||||
seq(
|
|
||||||
$.import_statement,
|
|
||||||
repeat1($._nl_semicolon)
|
|
||||||
),
|
|
||||||
seq(
|
|
||||||
$.script_part,
|
|
||||||
repeat1($._nl_semicolon)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
optional($.script_part)
|
|
||||||
),
|
),
|
||||||
static_modifier: $ => 'static',
|
static_modifier: $ => 'static',
|
||||||
import_statement: $ => seq(
|
_shebang_comment: $ => token.immediate(/#!.*\n/),
|
||||||
|
_script_statements: $ => seq(
|
||||||
|
$._script_statement,
|
||||||
|
repeat(
|
||||||
|
seq(
|
||||||
|
$._sep,
|
||||||
|
$._script_statement
|
||||||
|
)
|
||||||
|
),
|
||||||
|
repeat($._sep)
|
||||||
|
),
|
||||||
|
import_declaration: $ => seq(
|
||||||
'import',
|
'import',
|
||||||
optional($.static_modifier),
|
optional($.static_modifier),
|
||||||
field('name',
|
field('name',
|
||||||
seq(
|
seq($.qualified_name,
|
||||||
$.identifier,
|
optional($.wildcard_import)
|
||||||
repeat(seq('.', $.identifier)),
|
|
||||||
optional(seq('.', '*')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
_shebang_comment: $ => token.immediate(/#!.*\n/),
|
wildcard_import: $ => seq('.','*'),
|
||||||
package_definition: $ => seq(
|
package_declaration: $ => seq(
|
||||||
|
optional($._annotations),
|
||||||
'package',
|
'package',
|
||||||
field('name', seq(
|
field('name', $.qualified_name)
|
||||||
$.identifier,
|
|
||||||
repeat(seq('.', $.identifier))))
|
|
||||||
),
|
),
|
||||||
script_part: $ => choice(
|
_annotations: $ => seq(
|
||||||
|
$.annotation,
|
||||||
|
repeat($.annotation)
|
||||||
|
),
|
||||||
|
annotation: $ => seq(
|
||||||
|
'@',
|
||||||
|
$.qualified_name
|
||||||
|
),
|
||||||
|
_script_statement: $ => choice(
|
||||||
|
$.import_declaration,
|
||||||
$.statement,
|
$.statement,
|
||||||
$.method_declaration
|
$.method_declaration
|
||||||
),
|
),
|
||||||
expression: $ => choice(
|
expression: $ => choice(
|
||||||
$.path_expression
|
$.qualified_name
|
||||||
),
|
),
|
||||||
path_expression: $ => seq(
|
qualified_name: $ => seq(
|
||||||
repeat(
|
$.identifier,
|
||||||
seq($.identifier, '.')
|
repeat(seq('.', $.identifier))
|
||||||
),
|
|
||||||
$.identifier
|
|
||||||
),
|
),
|
||||||
identifier: $ => /[A-Za-z_][A-Za-z_0-9]*/,
|
identifier: $ => /[A-Za-z_][A-Za-z_0-9]*/,
|
||||||
statement: $ => choice(
|
statement: $ => choice(
|
||||||
$.expression
|
$.expression
|
||||||
),
|
),
|
||||||
method_declaration: $ => seq('def', field('name', $.identifier)),
|
method_declaration: $ => seq('def', field('name', $.identifier)),
|
||||||
_nl_semicolon: $ => choice('\n', ';'),
|
_sep: $ => choice('\n', ';'),
|
||||||
word: $ => $.identifier
|
word: $ => $.identifier
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
240
src/grammar.json
240
src/grammar.json
@ -24,13 +24,13 @@
|
|||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "package_definition"
|
"name": "package_declaration"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "REPEAT",
|
"type": "REPEAT",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_nl_semicolon"
|
"name": "_sep"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -40,52 +40,12 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "REPEAT",
|
|
||||||
"content": {
|
|
||||||
"type": "CHOICE",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "import_statement"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "REPEAT1",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_nl_semicolon"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "script_part"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "REPEAT1",
|
|
||||||
"content": {
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_nl_semicolon"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "script_part"
|
"name": "_script_statements"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "BLANK"
|
"type": "BLANK"
|
||||||
@ -98,7 +58,46 @@
|
|||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "static"
|
"value": "static"
|
||||||
},
|
},
|
||||||
"import_statement": {
|
"_shebang_comment": {
|
||||||
|
"type": "IMMEDIATE_TOKEN",
|
||||||
|
"content": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "#!.*\\n"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_script_statements": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_script_statement"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_sep"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_script_statement"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_sep"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"import_declaration": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
@ -125,39 +124,14 @@
|
|||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "qualified_name"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "REPEAT",
|
|
||||||
"content": {
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "SYMBOL",
|
||||||
"members": [
|
"name": "wildcard_import"
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "*"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "BLANK"
|
"type": "BLANK"
|
||||||
@ -169,16 +143,34 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"_shebang_comment": {
|
"wildcard_import": {
|
||||||
"type": "IMMEDIATE_TOKEN",
|
|
||||||
"content": {
|
|
||||||
"type": "PATTERN",
|
|
||||||
"value": "#!.*\\n"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"package_definition": {
|
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"package_declaration": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_annotations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "package"
|
"value": "package"
|
||||||
@ -187,36 +179,48 @@
|
|||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "name",
|
"name": "name",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SEQ",
|
"type": "SYMBOL",
|
||||||
"members": [
|
"name": "qualified_name"
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "REPEAT",
|
|
||||||
"content": {
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "STRING",
|
|
||||||
"value": "."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"script_part": {
|
"_annotations": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "annotation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "annotation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"annotation": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "@"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "qualified_name"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_script_statement": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "import_declaration"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "statement"
|
"name": "statement"
|
||||||
@ -232,32 +236,32 @@
|
|||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "path_expression"
|
"name": "qualified_name"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"path_expression": {
|
"qualified_name": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "REPEAT",
|
"type": "REPEAT",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "."
|
"value": "."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "identifier"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -291,7 +295,7 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"_nl_semicolon": {
|
"_sep": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
@ -315,7 +319,11 @@
|
|||||||
"value": "\\s"
|
"value": "\\s"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"conflicts": [],
|
"conflicts": [
|
||||||
|
[
|
||||||
|
"qualified_name"
|
||||||
|
]
|
||||||
|
],
|
||||||
"precedences": [],
|
"precedences": [],
|
||||||
"externals": [],
|
"externals": [],
|
||||||
"inline": [],
|
"inline": [],
|
||||||
|
|||||||
@ -1,4 +1,19 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"type": "annotation",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "qualified_name",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "expression",
|
"type": "expression",
|
||||||
"named": true,
|
"named": true,
|
||||||
@ -8,14 +23,14 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "path_expression",
|
"type": "qualified_name",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "import_statement",
|
"type": "import_declaration",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": {
|
"name": {
|
||||||
@ -23,15 +38,11 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "*",
|
"type": "qualified_name",
|
||||||
"named": false
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": ".",
|
"type": "wildcard_import",
|
||||||
"named": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -65,27 +76,33 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "package_definition",
|
"type": "package_declaration",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": {
|
"name": {
|
||||||
"multiple": true,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": ".",
|
"type": "qualified_name",
|
||||||
"named": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "identifier",
|
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "annotation",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path_expression",
|
"type": "qualified_name",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
@ -99,25 +116,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "script_part",
|
|
||||||
"named": true,
|
|
||||||
"fields": {},
|
|
||||||
"children": {
|
|
||||||
"multiple": false,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "method_declaration",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "statement",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "source_file",
|
"type": "source_file",
|
||||||
"named": true,
|
"named": true,
|
||||||
@ -127,15 +125,19 @@
|
|||||||
"required": false,
|
"required": false,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "import_statement",
|
"type": "import_declaration",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "package_definition",
|
"type": "method_declaration",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "script_part",
|
"type": "package_declaration",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "statement",
|
||||||
"named": true
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -156,6 +158,11 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "wildcard_import",
|
||||||
|
"named": true,
|
||||||
|
"fields": {}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "\n",
|
"type": "\n",
|
||||||
"named": false
|
"named": false
|
||||||
@ -172,6 +179,10 @@
|
|||||||
"type": ";",
|
"type": ";",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "@",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "def",
|
"type": "def",
|
||||||
"named": false
|
"named": false
|
||||||
|
|||||||
1748
src/parser.c
1748
src/parser.c
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,9 @@ import wibble
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(import_statement
|
(import_declaration
|
||||||
(identifier)))
|
(qualified_name
|
||||||
|
(identifier))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
multiple identifier import
|
multiple identifier import
|
||||||
@ -17,9 +18,10 @@ import wobble.qq
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(import_statement
|
(import_declaration
|
||||||
(identifier)
|
(qualified_name
|
||||||
(identifier)))
|
(identifier)
|
||||||
|
(identifier))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
wildcard import
|
wildcard import
|
||||||
@ -29,9 +31,11 @@ import flobble.fnurfle.*
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(import_statement
|
(import_declaration
|
||||||
(identifier)
|
(qualified_name
|
||||||
(identifier)))
|
(identifier)
|
||||||
|
(identifier))
|
||||||
|
(wildcard_import)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
multiple imports semicolon separated
|
multiple imports semicolon separated
|
||||||
@ -40,11 +44,14 @@ import qq.ss; import flobble.*;
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(import_statement
|
(import_declaration
|
||||||
(identifier)
|
(qualified_name
|
||||||
(identifier))
|
(identifier)
|
||||||
(import_statement
|
(identifier)))
|
||||||
(identifier)))
|
(import_declaration
|
||||||
|
(qualified_name
|
||||||
|
(identifier))
|
||||||
|
(wildcard_import)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
static import
|
static import
|
||||||
@ -53,7 +60,21 @@ import static qq.q.*;
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(import_statement
|
(import_declaration
|
||||||
(static_modifier)
|
(static_modifier)
|
||||||
(identifier)
|
(qualified_name
|
||||||
(identifier)))
|
(identifier)
|
||||||
|
(identifier))
|
||||||
|
(wildcard_import)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
simple wildcard
|
||||||
|
================================================================================
|
||||||
|
import wibble.*;
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(import_declaration
|
||||||
|
(qualified_name
|
||||||
|
(identifier))
|
||||||
|
(wildcard_import)))
|
||||||
|
|||||||
@ -5,8 +5,9 @@ package flob
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(package_definition
|
(package_declaration
|
||||||
(identifier)))
|
(qualified_name
|
||||||
|
(identifier))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Dotted package definition
|
Dotted package definition
|
||||||
@ -15,6 +16,7 @@ package flob.wibble
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(package_definition
|
(package_declaration
|
||||||
(identifier)
|
(qualified_name
|
||||||
(identifier)))
|
(identifier)
|
||||||
|
(identifier))))
|
||||||
|
|||||||
@ -6,11 +6,10 @@ hello
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(script_part
|
(statement
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(qualified_name
|
||||||
(path_expression
|
(identifier)))))
|
||||||
(identifier))))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Shebang not ignored after first character
|
Shebang not ignored after first character
|
||||||
@ -20,14 +19,14 @@ Shebang not ignored after first character
|
|||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(ERROR
|
(ERROR
|
||||||
(UNEXPECTED '#')
|
(UNEXPECTED '#'))
|
||||||
(identifier)
|
(statement
|
||||||
|
(expression
|
||||||
|
(qualified_name
|
||||||
|
(identifier))))
|
||||||
|
(ERROR
|
||||||
(UNEXPECTED '/')
|
(UNEXPECTED '/')
|
||||||
(identifier)
|
(identifier)
|
||||||
(UNEXPECTED '/')
|
(UNEXPECTED '/')
|
||||||
(identifier))
|
(identifier)
|
||||||
(script_part
|
(identifier)))
|
||||||
(statement
|
|
||||||
(expression
|
|
||||||
(path_expression
|
|
||||||
(identifier))))))
|
|
||||||
|
|||||||
@ -13,11 +13,10 @@ hello
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(script_part
|
(statement
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(qualified_name
|
||||||
(path_expression
|
(identifier)))))
|
||||||
(identifier))))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
statement - Simple method definition
|
statement - Simple method definition
|
||||||
@ -26,9 +25,8 @@ def hello
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(script_part
|
(method_declaration
|
||||||
(method_declaration
|
(identifier)))
|
||||||
(identifier))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
statement - Multiple statements same line
|
statement - Multiple statements same line
|
||||||
@ -37,19 +35,16 @@ hello;goodbye;def flunk
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(script_part
|
(statement
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(qualified_name
|
||||||
(path_expression
|
(identifier))))
|
||||||
(identifier)))))
|
(statement
|
||||||
(script_part
|
(expression
|
||||||
(statement
|
(qualified_name
|
||||||
(expression
|
(identifier))))
|
||||||
(path_expression
|
(method_declaration
|
||||||
(identifier)))))
|
(identifier)))
|
||||||
(script_part
|
|
||||||
(method_declaration
|
|
||||||
(identifier))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
statement - Multiple Statements, Multiple Lines
|
statement - Multiple Statements, Multiple Lines
|
||||||
@ -60,19 +55,16 @@ goodbye;
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(script_part
|
(statement
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(qualified_name
|
||||||
(path_expression
|
(identifier))))
|
||||||
(identifier)))))
|
(method_declaration
|
||||||
(script_part
|
(identifier))
|
||||||
(method_declaration
|
(statement
|
||||||
(identifier)))
|
(expression
|
||||||
(script_part
|
(qualified_name
|
||||||
(statement
|
(identifier)))))
|
||||||
(expression
|
|
||||||
(path_expression
|
|
||||||
(identifier))))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
statement - path expression multiple parts
|
statement - path expression multiple parts
|
||||||
@ -81,10 +73,9 @@ wibble.wobble.q
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(script_part
|
(statement
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(qualified_name
|
||||||
(path_expression
|
(identifier)
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)
|
(identifier)))))
|
||||||
(identifier))))))
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user