/
Elixir.bnf
2950 lines (2640 loc) · 127 KB
/
Elixir.bnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
parserClass="org.elixir_lang.parser.ElixirParser"
extends="com.intellij.extapi.psi.ASTWrapperPsiElement"
// direct children of matchedExpression
extends("matched(AccessExpression|.*Operation|((((At)?Unq)|Q)ualified(No)?(Argument|Parenthese)s|Dot)Call|Qualified(Alias|MultipleAliases))")=matchedExpression
// direct children of unmatchedExpression
extends("unmatched(AccessExpression|.*Operation|((((At)?Unq)|Q)ualified(No)?(Argument|Parenthese)s|Dot)Call|Qualified(Alias|MultipleAliases))")=unmatchedExpression
// name identifier owner calls - no argument calls are included because in a pipeline they can have effective arguments
elementTypeFactory("((un)?matched((((At)?Unq)|Q)ualified(No)?(Argument|Parenthese)s|Dot)|unqualifiedNoParenthesesManyArguments)Call")="org.elixir_lang.ElementTypeFactory.factory"
methods( "((un)?matched((At)?Unqualified(No)?(Argument|Parenthese)s|Dot)|unqualifiedNoParenthesesManyArguments)Call")=[
canonicalName
canonicalNameSet
functionName
functionNameElement
getDoBlock
hasDoBlockOrKeyword
getName
getNameIdentifier
getPresentation
getReference
getStub
getUseScope
isCalling
isCallingMacro
moduleName
primaryArguments
primaryArity
processDeclarations
quote
resolvedFinalArity
resolvedFinalArityRange
resolvedModuleName
resolvedPrimaryArity
resolvedSecondaryArity
secondaryArguments
secondaryArity
setName
]
// qualified calls that need to implement #qualifier()
methods("(un)?matchedQualified(No)?(Argument|Parenthese)sCall")=[
canonicalName
canonicalNameSet
functionName
functionNameElement
getDoBlock
hasDoBlockOrKeyword
getName
getNameIdentifier
getPresentation
getReference
getStub
getUseScope
isCalling
isCallingMacro
moduleName
primaryArguments
primaryArity
processDeclarations
qualifier
quote
resolvedFinalArity
resolvedFinalArityRange
resolvedModuleName
resolvedPrimaryArity
resolvedSecondaryArity
secondaryArguments
secondaryArity
setName
]
// in operations that works as calls
implements("(un)?matchedInOperation")=[
"org.elixir_lang.psi.call.Call"
"org.elixir_lang.psi.operation.In"
]
// methods set by infix operations below
/* infix operations that work as name identifier owner calls - specifically support getNameIdentifier so they can
return their operator, so it is easy to use a different operator when making customer operators like in Bitwise or
the free arrow operators */
implements( "(un)?matched(Comparison|Multiplication|Relational)Operation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Infix"
]
methods( "(un)?matched(Addition|And|Arrow|Comparison|In|InMatch|Match|Multiplication|Or|Pipe|Relational|Three|Two|Type|When)Operation")=[
functionName
functionNameElement
getDoBlock
getName
getNameIdentifier
hasDoBlockOrKeyword
isCalling
isCallingMacro
leftOperand
moduleName
operator
primaryArguments
primaryArity
processDeclarations
quote
resolvedFinalArity
resolvedFinalArityRange
resolvedModuleName
resolvedPrimaryArity
resolvedSecondaryArity
rightOperand
secondaryArguments
secondaryArity
setName
]
implements("(un)?matchedAdditionOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Addition"
]
// methods set by infix operations above
implements("(un)?matchedAndOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.And"
]
// methods set by infix operations above
implements("(un)?matchedArrowOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Arrow"
]
implements("(un)?matchedInMatchOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.InMatch"
]
// methods set by infix operations above
implements("(un)?matchedMatchOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Match"
]
// methods set by infix operations above
implements("(un)?matchedOrOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Or"
]
// methods set by infix operations above
implements("(un)?matchedPipeOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Pipe"
]
// methods set by infix operations above
implements("(un)?matchedThreeOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Three"
]
// methods set by infix operations above
implements("(un)?matchedTwoOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Two"
]
// methods set by infix operations above
implements("(un)?matchedTypeOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Type"
]
// methods set by infix operations above
implements("(un)?matchedWhenOperation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.When"
]
// methods set by infix operations above
/*
* Prefix operations
*
* Have names (their operators), but aren't stubbed because they don't define structures.
*/
implements( "((at|capture|unary)Numeric|(un)?matched(Capture)NonNumeric)Operation")=[
"org.elixir_lang.psi.call.Named"
"org.elixir_lang.psi.operation.Prefix"
]
methods( "((at|capture|unary)Numeric|(un)?matched(Capture|Unary)NonNumeric)Operation")=[
functionName
functionNameElement
getDoBlock
getName
getNameIdentifier
hasDoBlockOrKeyword
isCalling
isCallingMacro
moduleName
operand
operator
primaryArguments
primaryArity
quote
secondaryArguments
secondaryArity
resolvedFinalArity
resolvedFinalArityRange
resolvedModuleName
resolvedPrimaryArity
resolvedSecondaryArity
setName
]
// atNonNumeric operations
implements("(un)?matchedAtNonNumericOperation")=[
"org.elixir_lang.psi.AtNonNumericOperation"
]
methods("(un)?matchedAtNonNumericOperation")=[
getReference
moduleAttributeName
operand
operator
quote
]
// unaryNonNumeric operations
implements("(un)?matchedUnaryNonNumericOperation")=[
"org.elixir_lang.psi.UnaryNonNumericOperation"
]
// method set by prefix operations above
// QualifiedBracketOperation
implements("(un)?matchedQualifiedBracketOperation")=[
"org.elixir_lang.psi.QualifiedBracketOperation"
]
methods( "(un)?matchedQualifiedBracketOperation")=[
qualifier
quote
]
// QualifiedMultipleAliases
implements("(un)?matchedQualifiedMultipleAliases")=[
"org.elixir_lang.psi.QualifiedMultipleAliases"
]
methods( "(un)?matchedQualifiedMultipleAliases")=[
quote
]
// Heredoc
methods("(charList|string)Heredoc")=[
addEscapedCharacterCodePoints
addEscapedEOL
addFragmentCodePoints
addHexadecimalEscapeSequenceCodePoints
getFragmentType
getHeredocLineList
quote
quoteBinary
quoteEmpty
quoteLiteral
]
// Quote
methods("(charList|string)Line") = [
addEscapedCharacterCodePoints
addEscapedEOL
addFragmentCodePoints
addHexadecimalEscapeSequenceCodePoints
getBody
getFragmentType
quote
quoteAsAtom
quoteBinary
quoteEmpty
quoteLiteral
]
// Sigil Heredoc
methods("(interpolated|literal)((CharList|String)Sigil|Regex|Sigil|Words)Heredoc") = [
addEscapedCharacterCodePoints
addEscapedEOL
addFragmentCodePoints
addHexadecimalEscapeSequenceCodePoints
getFragmentType
getHeredocLineList
quote
quoteBinary
quoteEmpty
quoteLiteral
sigilName
]
// Sigil Line
methods("(interpolated|literal)((CharList|String)Sigil|Regex|Sigil|Words)Line") = [
addEscapedCharacterCodePoints
addEscapedEOL
addFragmentCodePoints
addHexadecimalEscapeSequenceCodePoints
getBody
getFragmentType
quote
quoteBinary
quoteEmpty
quoteLiteral
sigilName
terminator
]
psiClassPrefix="Elixir"
psiImplClassSuffix="Impl"
psiPackage="org.elixir_lang.psi"
psiImplPackage="org.elixir_lang.psi.impl"
psiImplUtilClass="org.elixir_lang.psi.impl.ElixirPsiImplUtil"
elementTypeHolderClass="org.elixir_lang.psi.ElixirTypes"
elementTypeClass="org.elixir_lang.psi.ElixirElementType"
tokenTypeClass="org.elixir_lang.psi.ElixirTokenType"
tokens = [
AFTER = "after"
ALIAS_TOKEN = "Alias"
AND_SYMBOL_OPERATOR = "&&&, &&"
AND_WORD_OPERATOR = "`and`"
ARROW_OPERATOR = "<<<, <<~, <|>, <~>, >>>, ~>>, <~, |>, ~>"
ASSOCIATION_OPERATOR = "=>"
ATOM_FRAGMENT = "A-Z, a-z, _, @, 0-9. ?, !"
AT_OPERATOR = "@"
BASE_WHOLE_NUMBER_PREFIX = "0"
BINARY_WHOLE_NUMBER_BASE = "b"
BIT_STRING_OPERATOR = "<<>>"
CALL = "<zero-width-call>"
CAPTURE_OPERATOR = "&"
CATCH = "catch"
CHAR_LIST_FRAGMENT = "Char List Fragment"
CHAR_LIST_HEREDOC_PROMOTER = "Char List Heredoc Promoter (''')"
CHAR_LIST_HEREDOC_TERMINATOR = "Char List Heredoc Terminator (''')"
CHAR_LIST_PROMOTER = "Char List Promoter (')"
CHAR_LIST_SIGIL_HEREDOC_PROMOTER = "Char List Sigil Heredoc Promoter (\"\"\", ''')"
CHAR_LIST_SIGIL_HEREDOC_TERMINATOR = "Char List Sigil Heredoc Terminator (\"\"\", ''')"
CHAR_LIST_SIGIL_PROMOTER = "Char List Sigil Promoter ({, [, <, \", /, (, |, ')"
CHAR_LIST_SIGIL_TERMINATOR = "Char List Sigil Terminator ({, [, <, \", /, (, |, ')"
CHAR_LIST_TERMINATOR = "Char List Terminator (')"
CHAR_TOKENIZER = "?"
CLOSING_BIT = ">>"
CLOSING_BRACKET = "]"
CLOSING_CURLY = "}"
// TODO remove once CLOSING_PARENTHESIS is used in emptyParentheses rule
CLOSING_PARENTHESIS = ")"
COLON = ":"
COMMA = ","
COMMENT = "#"
COMPARISON_OPERATOR = "!==, ===, !=, ==, =~"
DECIMAL_MARK = "Decimal Mark (.)"
DECIMAL_SEPARATOR = "_"
DIVISION_OPERATOR = "/"
DO = "do"
DOT_OPERATOR = "."
DUAL_OPERATOR = "+, -"
ELSE = "else"
EOL = "\\n, \\r\\n"
END = "end"
ESCAPE = "\\"
ESCAPED_CHARACTER_TOKEN = "\\<character>, \\x{<hexadecimal-digit>}, \\x<hexadecimal-digit>, \\\\n, \\\\r\\n"
EXPONENT_MARK = "E, e"
FALSE = "false"
FN = "fn"
HEREDOC_LINE_WHITE_SPACE_TOKEN = "Whitespace at beginning of line of heredoc"
HEREDOC_PREFIX_WHITE_SPACE = "Whitespace at beginning of last line of heredoc before terminator"
HEXADECIMAL_WHOLE_NUMBER_BASE = "x"
IDENTIFIER_TOKEN = "identifier"
INTERPOLATING_CHAR_LIST_SIGIL_NAME = "c"
INTERPOLATING_REGEX_SIGIL_NAME = "r"
INTERPOLATING_SIGIL_NAME = "a-b, d-q, t-v, x-z"
INTERPOLATING_STRING_SIGIL_NAME = "s"
INTERPOLATING_WORDS_SIGIL_NAME = "w"
// Can't be just "}", because that's used for the more general CLOSING_CURLY
INTERPOLATION_END = "Interpolation End (})"
// Human-readable "Interpolation Start" to match format of INTERPOLATION_END
INTERPOLATION_START = "Interpolation Start (#{)"
INVALID_BINARY_DIGITS = "A-Z, a-z, 2-9"
INVALID_DECIMAL_DIGITS = "A-Z, a-z"
INVALID_HEXADECIMAL_DIGITS = "G-Z, g-z"
INVALID_OCTAL_DIGITS = "A-Z, a-z, 8-9"
INVALID_UNKNOWN_BASE_DIGITS = "A-Z, a-z, 0-9"
IN_MATCH_OPERATOR = "<-, \\\\"
IN_OPERATOR = "in"
KEYWORD_PAIR_COLON = "Keyword Pair Colon (:)"
LITERAL_CHAR_LIST_SIGIL_NAME = "C"
LITERAL_REGEX_SIGIL_NAME = "R"
LITERAL_SIGIL_NAME = "A-B, D-Q, T-V, X-Z"
LITERAL_STRING_SIGIL_NAME = "S"
LITERAL_WORDS_SIGIL_NAME = "W"
MAP_OPERATOR = "%{}"
MATCH_OPERATOR = "="
MULTIPLICATION_OPERATOR = "*"
NIL = "nil"
NOT_OPERATOR = "not"
OBSOLETE_BINARY_WHOLE_NUMBER_BASE = "B"
OBSOLETE_HEXADECIMAL_WHOLE_NUMBER_BASE = "X"
OCTAL_WHOLE_NUMBER_BASE = "o"
OPENING_BIT = "<<"
OPENING_BRACKET = "["
OPENING_CURLY = "{"
OPENING_PARENTHESIS = "("
OR_SYMBOL_OPERATOR = "|||, ||"
OR_WORD_OPERATOR = "`or`"
PIPE_OPERATOR = "|"
RANGE_OPERATOR = ".."
REGEX_FRAGMENT = "Regex Fragment"
REGEX_HEREDOC_PROMOTER = "Regex Heredoc Promoter (\"\"\", ''')"
REGEX_HEREDOC_TERMINATOR = "Regex Heredoc Terminator (\"\"\", ''')"
REGEX_PROMOTER = "Regex Promoter ({, [, <, \", /, (, |, ')"
REGEX_TERMINATOR = "Regex Terminator ({, [, <, \", /, (, |, ')"
RELATIONAL_OPERATOR = "<, <=, >=, >"
RESCUE = "rescue"
// TOO remove once SEMICOLON is used in endOfExpression rule
SEMICOLON = ";"
SIGIL_FRAGMENT = "Sigil Fragment"
SIGIL_HEREDOC_PROMOTER = "Sigil Heredoc Promoter (\"\"\", ''')"
SIGIL_HEREDOC_TERMINATOR = "Sigil Heredoc Terminator (\"\"\", ''')"
SIGIL_MODIFIER = "a-z"
SIGIL_PROMOTER = "Sigil Promoter ({, [, <, \", /, (, |, ')"
SIGIL_TERMINATOR = "Sigil Terminator ({, [, <, \", /, (, |, ')"
SIGNIFICANT_WHITE_SPACE = "<significant-space>";
STAB_OPERATOR = "->"
STRING_FRAGMENT = "String Fragment"
STRING_HEREDOC_PROMOTER = "String Heredoc Promoter (\"\"\")"
STRING_HEREDOC_TERMINATOR = "String Heredoc Terminator (\"\"\")"
STRING_PROMOTER = "String Promoter (\")"
STRING_SIGIL_HEREDOC_PROMOTER = "String Sigil Heredoc Promoter (\"\"\", ''')"
STRING_SIGIL_HEREDOC_TERMINATOR = "String Sigil Heredoc Terminator (\"\"\", ''')"
STRING_SIGIL_PROMOTER = "String Sigil Promoter ({, [, <, \", /, (, |, ')"
STRING_SIGIL_TERMINATOR = "String Sigil Terminator ({, [, <, \", /, (, |, ')"
STRING_TERMINATOR = "String Terminator (\")"
// TODO remove once containers are available for `{}` after alias for empty structs
STRUCT_OPERATOR = "%"
TILDE = "~"
TRUE = "true"
TUPLE_OPERATOR = "{}"
TWO_OPERATOR = "++, --, <>"
// https://github.com/elixir-lang/elixir/commit/3487d00ddb5e90c7cf0e65d03717903b9b27eafd
THREE_OPERATOR = "^^^"
TYPE_OPERATOR = "::"
UNARY_OPERATOR = "~~~, !, ^"
UNICODE_ESCAPE_CHARACTER = "u"
UNKNOWN_WHOLE_NUMBER_BASE = "A-Z, a, c-n, p-w, z"
VALID_BINARY_DIGITS = "0-1"
VALID_DECIMAL_DIGITS = "0-9"
VALID_HEXADECIMAL_DIGITS = "A-F, a-f, 0-9"
VALID_OCTAL_DIGITS = "0-7"
WHEN_OPERATOR = "when"
WORDS_FRAGMENT = "Words Fragment"
WORDS_HEREDOC_PROMOTER = "Words Heredoc Promoter (\"\"\", ''')"
WORDS_HEREDOC_TERMINATOR = "Words Heredoc Terminator (\"\"\", ''')"
WORDS_PROMOTER = "Words Promoter ({, [, <, \", /, (, |, ')"
WORDS_TERMINATOR = "Words Terminator ({, [, <, \", /, (, |, ')"
]
}
// expressionList is optional to handle code-less file that contains only EOL between blank lines and order comment
// lines
private elixirFile ::= endOfExpression? (expressionList endOfExpression?)?
/*
*
*
* Expression List
*
*
*/
private infixSemicolon ::= EOL* SEMICOLON EOL*
// Must have at least one EOL or SEMICOLON, but at most one SEMICOLON
endOfExpression ::= infixSemicolon | EOL+ { implements = "org.elixir_lang.psi.Unquoted" }
/*
*
* Expression
*
*/
private expression ::= emptyParentheses |
unmatchedExpression |
unqualifiedNoParenthesesManyArgumentsCall
{ recoverWhile = expressionRecoverWhile }
// EOL and SEMICOLON for endOfExpression
/* INTERPOLATION_END because interpolation(elixirFile(expression)) needs expression to stop of on INTERPOLATION_END for
interpolation */
// END for stabBody's usage of expression
// CLOSING_* because they are endings to subexpressions
// STAB_OPERATOR because it ends when clause for no parentheses stab guard clauses
// blockIdentifier for one-liner blockItems where there isn't a newline between block expressions and following blockIdentifier.
private expressionRecoverWhile ::= !(EOL | CLOSING_BIT | CLOSING_BRACKET | CLOSING_CURLY | CLOSING_PARENTHESIS | INTERPOLATION_END | SEMICOLON | STAB_OPERATOR | END | blockIdentifier)
private expressionList ::= expression (endOfExpression expression)*
/*
*
*
* Function Calls
*
*
*/
/*
*
* No Parentheses
*
*/
/*
* Many Arguments
*/
/* Have to prevent matchedExpression that is actually a keywordKey from being parsed as just a matchedExpression or
callArgumentsNoParenthesesCommaExpression COMMA EOL* callArgumentsNoParenthesesKeywords will never match. */
private noParenthesesExpression ::= emptyParentheses |
/* Must be before matchedExpression because noParenthesesExpression is
`matchedExpressionDotIdentifier callArgumentsNoParenthesesManyStrict` which is
longer than `matchedExpressionDotIdentifier` in matchedExpression. */
/* This will be marked as an error by
{@link org.elixir_lang.inspection.NoParenthesesManyStrict} */
noParenthesesManyStrictNoParenthesesExpression |
matchedExpression
/* Special class for wrapping noParenthesesCall so that
{@link: org.elixir_lang.inspection.NoParenthesesManyStrict} can just search for
ElixirNoParenthesesManyStrictNoParenthesesExpression isn't of having to differentiate between valid and invalid
ElixirNoParenthesesCall. */
noParenthesesManyStrictNoParenthesesExpression ::= unqualifiedNoParenthesesManyArgumentsCall
{ implements = "org.elixir_lang.psi.Quotable" methods = [quote] }
/* Special class for wrapping rules so that
{@link: org.elixir_lang.inspection.NoParenthesesStrict} can just search for
ElixirNoParenthesesStrict instead of having to differentiate between valid and invalid
rule classes. */
noParenthesesStrict ::= emptyParentheses |
OPENING_PARENTHESIS (
noParenthesesKeywords |
noParenthesesManyArguments
) CLOSING_PARENTHESIS
{
implements = [
"org.elixir_lang.psi.Arguments"
"org.elixir_lang.psi.QuotableArguments"
]
methods = [
arguments
quoteArguments
]
}
/* 1. (positional, keywords)
2. (positional, positional)
3. (positional, positional, keywords) */
private noParenthesesManyArguments ::= matchedExpression infixComma noParenthesesKeywords |
!additionTail matchedExpression (infixComma noParenthesesExpression)+ (infixComma noParenthesesKeywords)?
private noParenthesesManyArgumentsStrict ::= noParenthesesManyArguments |
noParenthesesStrict
// A rule instead of a token so that there is a PsiElement to return from getNameIdentifier
identifier ::= IDENTIFIER_TOKEN
{
implements = "org.elixir_lang.psi.Quotable"
methods = [
getPresentation
quote
]
}
// @see https://github.com/elixir-lang/elixir/blob/de39bbaca277002797e52ffbde617ace06233a2b/lib/elixir/src/elixir_parser.yrl#L124-L125
unqualifiedNoParenthesesManyArgumentsCall ::= identifier !KEYWORD_PAIR_COLON
noParenthesesManyArgumentsStrict
{
implements = [
// MUST be first so visitElement is used in ElixirVisitor
"com.intellij.psi.PsiElement"
"org.elixir_lang.psi.call.StubBased<org.elixir_lang.psi.stub.UnqualifiedNoParenthesesManyArgumentsCall>"
"org.elixir_lang.psi.call.arguments.star.NoParentheses"
"org.elixir_lang.psi.qualification.Unqualified"
"org.elixir_lang.psi.Quotable"
]
mixin = "org.elixir_lang.psi.impl.NamedStubbedPsiElementBase<org.elixir_lang.psi.stub.UnqualifiedNoParenthesesManyArgumentsCall>"
stubClass = "org.elixir_lang.psi.stub.UnqualifiedNoParenthesesManyArgumentsCall"
}
/*
* 1+ Arguments
*/
noParenthesesKeywords ::= noParenthesesKeywordPair (infixComma noParenthesesKeywordPair)*
{
implements = "org.elixir_lang.psi.QuotableKeywordList"
methods = [
quotableKeywordPairList
quote
]
}
noParenthesesKeywordPair ::= keywordKeyColonEOL noParenthesesExpression
{
implements = "org.elixir_lang.psi.QuotableKeywordPair"
methods = [
getKeywordKey
getKeywordValue
quote
]
}
/*
* 0 Arguments
*/
variable ::= IDENTIFIER_TOKEN !KEYWORD_PAIR_COLON
{
implements = [
"org.elixir_lang.psi.NamedElement"
"org.elixir_lang.psi.Quotable"
]
methods = [
getName
getNameIdentifier
quote
setName
]
}
/*
*
*
* Heredoc
*
*
*/
heredocLinePrefix ::= HEREDOC_LINE_WHITE_SPACE_TOKEN? { methods = [excessWhitespace] }
heredocPrefix ::= HEREDOC_PREFIX_WHITE_SPACE?
/*
*
* Quote Heredocs
*
*/
/*
* CharList Heredoc
*/
charListHeredoc ::= CHAR_LIST_HEREDOC_PROMOTER EOL
charListHeredocLine*
heredocPrefix CHAR_LIST_HEREDOC_TERMINATOR
{
implements = [
"org.elixir_lang.psi.Heredoc"
"org.elixir_lang.psi.InterpolatedCharList"
"org.elixir_lang.psi.Quote"
]
pin = CHAR_LIST_HEREDOC_PROMOTER
}
charListHeredocLine ::= heredocLinePrefix quoteCharListBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
/*
* String Heredoc
*/
stringHeredoc ::= STRING_HEREDOC_PROMOTER EOL
stringHeredocLine*
heredocPrefix STRING_HEREDOC_TERMINATOR
{
implements = [
"org.elixir_lang.psi.Heredoc"
"org.elixir_lang.psi.InterpolatedString"
]
pin = STRING_HEREDOC_PROMOTER
}
stringHeredocLine ::= heredocLinePrefix quoteStringBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
/*
*
* Interpolated Sigil Heredocs
*
*/
sigilModifiers ::= SIGIL_MODIFIER* { implements = "org.elixir_lang.psi.Quotable" methods = [quote] }
interpolatedCharListSigilHeredoc ::= TILDE INTERPOLATING_CHAR_LIST_SIGIL_NAME CHAR_LIST_SIGIL_HEREDOC_PROMOTER EOL
interpolatedCharListHeredocLine*
heredocPrefix CHAR_LIST_SIGIL_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.CharListFragmented"
"org.elixir_lang.psi.InterpolatedCharListHeredocLined"
"org.elixir_lang.psi.InterpolatedSigilHeredoc"
]
pin = CHAR_LIST_SIGIL_HEREDOC_PROMOTER
}
interpolatedCharListHeredocLine ::= heredocLinePrefix interpolatedCharListBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
interpolatedCharListBody ::= (interpolation | CHAR_LIST_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
interpolatedRegexHeredoc ::= TILDE INTERPOLATING_REGEX_SIGIL_NAME REGEX_HEREDOC_PROMOTER EOL
interpolatedRegexHeredocLine*
heredocPrefix REGEX_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.RegexFragmented"
"org.elixir_lang.psi.InterpolatedSigilHeredoc"
]
pin = REGEX_HEREDOC_PROMOTER
}
interpolatedRegexHeredocLine ::= heredocLinePrefix interpolatedRegexBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
interpolatedRegexBody ::= (interpolation | REGEX_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
interpolatedSigilHeredoc ::= TILDE INTERPOLATING_SIGIL_NAME SIGIL_HEREDOC_PROMOTER EOL
interpolatedSigilHeredocLine*
heredocPrefix SIGIL_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.InterpolatedSigilHeredoc"
"org.elixir_lang.psi.SigilFragmented"
]
pin = SIGIL_HEREDOC_PROMOTER
}
interpolatedSigilHeredocLine ::= heredocLinePrefix interpolatedSigilBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
interpolatedSigilBody ::= (interpolation | SIGIL_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
interpolatedStringSigilHeredoc ::= TILDE INTERPOLATING_STRING_SIGIL_NAME STRING_SIGIL_HEREDOC_PROMOTER EOL
interpolatedStringHeredocLine*
heredocPrefix STRING_SIGIL_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.StringFragmented"
"org.elixir_lang.psi.InterpolatedSigilHeredoc"
"org.elixir_lang.psi.InterpolatedStringHeredocLined"
]
pin = STRING_SIGIL_HEREDOC_PROMOTER
}
interpolatedStringHeredocLine ::= heredocLinePrefix interpolatedStringBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
interpolatedStringBody ::= (interpolation | STRING_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
interpolatedWordsHeredoc ::= TILDE INTERPOLATING_WORDS_SIGIL_NAME WORDS_HEREDOC_PROMOTER EOL
interpolatedWordsHeredocLine*
heredocPrefix WORDS_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.WordsFragmented"
"org.elixir_lang.psi.InterpolatedSigilHeredoc"
]
pin = WORDS_HEREDOC_PROMOTER
}
interpolatedWordsHeredocLine ::= heredocLinePrefix interpolatedWordsBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
interpolatedWordsBody ::= (interpolation | WORDS_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
/*
* Literal Sigil Heredocs
*/
literalCharListSigilHeredoc ::= TILDE LITERAL_CHAR_LIST_SIGIL_NAME CHAR_LIST_SIGIL_HEREDOC_PROMOTER EOL
literalCharListHeredocLine*
heredocPrefix CHAR_LIST_SIGIL_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.CharListFragmented"
"org.elixir_lang.psi.LiteralSigilHeredoc"
]
pin = CHAR_LIST_SIGIL_HEREDOC_PROMOTER
}
literalCharListHeredocLine ::= heredocLinePrefix literalCharListBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
// literals can have escape sequences for escaped terminator
literalCharListBody ::= (CHAR_LIST_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
literalRegexHeredoc ::= TILDE LITERAL_REGEX_SIGIL_NAME REGEX_HEREDOC_PROMOTER EOL
literalRegexHeredocLine*
heredocPrefix REGEX_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.RegexFragmented"
"org.elixir_lang.psi.LiteralSigilHeredoc"
]
pin = REGEX_HEREDOC_PROMOTER
}
literalRegexHeredocLine ::= heredocLinePrefix literalRegexBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
// literals can have escape sequences for escaped terminator
literalRegexBody ::= (REGEX_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
literalSigilHeredoc ::= TILDE LITERAL_SIGIL_NAME SIGIL_HEREDOC_PROMOTER EOL
literalSigilHeredocLine*
heredocPrefix SIGIL_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.SigilFragmented"
"org.elixir_lang.psi.LiteralSigilHeredoc"
]
pin = SIGIL_HEREDOC_PROMOTER
}
literalSigilHeredocLine ::= heredocLinePrefix literalSigilBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
// literals can have escape sequences for escaped terminator
literalSigilBody ::= (SIGIL_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
literalStringSigilHeredoc ::= TILDE LITERAL_STRING_SIGIL_NAME STRING_SIGIL_HEREDOC_PROMOTER EOL
literalStringHeredocLine*
heredocPrefix STRING_SIGIL_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.StringFragmented"
"org.elixir_lang.psi.LiteralSigilHeredoc"
]
pin = STRING_SIGIL_HEREDOC_PROMOTER
}
literalStringHeredocLine ::= heredocLinePrefix literalStringBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
// literals can have escape sequences for escaped terminator
literalStringBody ::= (STRING_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
literalWordsHeredoc ::= TILDE LITERAL_WORDS_SIGIL_NAME WORDS_HEREDOC_PROMOTER EOL
literalWordsHeredocLine*
heredocPrefix WORDS_HEREDOC_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.WordsFragmented"
"org.elixir_lang.psi.LiteralSigilHeredoc"
]
pin = WORDS_HEREDOC_PROMOTER
}
literalWordsHeredocLine ::= heredocLinePrefix literalWordsBody EOL
{
implements = [
"org.elixir_lang.psi.HeredocLine"
]
methods = [
getBody
quote
]
}
// literals can have escape sequences for escaped terminator
literalWordsBody ::= (WORDS_FRAGMENT | sigilEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
/*
*
*
* Lines (as opposed to Heredocs)
*
*
*/
/*
*
* Quote Lines
*
*/
quoteCharListBody ::= (interpolation | CHAR_LIST_FRAGMENT | quoteEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
charListLine ::= CHAR_LIST_PROMOTER quoteCharListBody CHAR_LIST_TERMINATOR
{
implements = [
"org.elixir_lang.psi.Atomable"
"org.elixir_lang.psi.InterpolatedCharList"
"org.elixir_lang.psi.Line"
"org.elixir_lang.psi.Quotable"
]
pin = CHAR_LIST_PROMOTER
}
quoteStringBody ::= (interpolation | STRING_FRAGMENT | quoteEscapeSequence)*
{ implements = "org.elixir_lang.psi.Body" }
stringLine ::= STRING_PROMOTER quoteStringBody STRING_TERMINATOR
{
implements = [
"org.elixir_lang.psi.Atomable"
"org.elixir_lang.psi.InterpolatedString"
"org.elixir_lang.psi.Line"
"org.elixir_lang.psi.Quotable"
]
pin = STRING_PROMOTER
}
/*
*
* Sigil Lines
*
*/
/*
* Interpolated Sigil Lines
*/
interpolatedCharListSigilLine ::= TILDE INTERPOLATING_CHAR_LIST_SIGIL_NAME CHAR_LIST_SIGIL_PROMOTER interpolatedCharListBody CHAR_LIST_SIGIL_TERMINATOR sigilModifiers
{
implements = [
"org.elixir_lang.psi.CharListFragmented"
"org.elixir_lang.psi.InterpolatedSigilLine"
]
pin = CHAR_LIST_SIGIL_PROMOTER
}