Skip to content

Commit ca66efd

Browse files
committed
Merge branch 'topic/checks_quick_fixes' into 'master'
Add auto-fix driver to the LKQL executable Closes #208 See merge request eng/libadalang/langkit-query-language!161
2 parents e8e05bb + a1335ca commit ca66efd

File tree

326 files changed

+4332
-860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+4332
-860
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ doc: build_lkql_native_jit
3636
cd user_manual && make clean html
3737
cd lkql_checker/doc && make generate html-all
3838

39+
format:
40+
$(MAVEN) -f lkql_jit spotless:apply
41+
3942
gnatcheck: lkql
4043
gprbuild -P lkql_checker/gnatcheck.gpr -p $(GPR_ARGS) -XBUILD_MODE=$(BUILD_MODE)
4144

Lines changed: 45 additions & 0 deletions
Loading

lkql/build/railroad-diagrams/value_expr.svg

Lines changed: 30 additions & 25 deletions
Loading

lkql/language/lexer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Token(LexerToken):
3030
Else = WithSymbol()
3131
Not = WithSymbol()
3232
Null = WithSymbol()
33+
New = WithSymbol()
3334
Import = WithSymbol()
3435

3536
Dot = WithText()
@@ -135,6 +136,7 @@ class Token(LexerToken):
135136
(Literal("then"), Token.Then),
136137
(Literal("not"), Token.Not),
137138
(Literal("null"), Token.Null),
139+
(Literal("new"), Token.New),
138140
(Pattern("[0-9]+"), Token.Integer),
139141
(Pattern("[a-z][A-Za-z0-9_]*"), Token.Identifier),
140142
(Pattern("[A-Za-z][A-Za-z0-9_]*"), Token.UpperIdentifier),

lkql/language/parser.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,14 @@ class SafeAccess(DotAccess):
344344
pass
345345

346346

347+
class UpperDotAccess(Expr):
348+
"""
349+
Access to a node kind field using the dot notation.
350+
"""
351+
receiver = Field(type=Identifier)
352+
member = Field(type=Identifier)
353+
354+
347355
class InClause(Expr):
348356
"""
349357
Check that a list contains a given value using the ``in`` keyword
@@ -845,6 +853,22 @@ def min_depth_expr():
845853
Self.depth_expr)
846854

847855

856+
class ConstructorCall(Expr):
857+
"""
858+
Call of a constructor.
859+
860+
For instance::
861+
862+
new IntLiteral("50")
863+
new BinOp(f_op=new OpPlus(),
864+
f_left=new IntLiteral("40"),
865+
f_right=new IntLiteral("2"))
866+
"""
867+
868+
name = Field(type=Identifier)
869+
arguments = Field(type=Arg.list)
870+
871+
848872
class RecExpr(Expr):
849873
"""
850874
Expression that is only valid in a selector. Describes the next actions of
@@ -1253,13 +1277,15 @@ class Tuple(Expr):
12531277

12541278
DotAccess(G.value_expr, ".", c(), G.id),
12551279
SafeAccess(G.value_expr, "?.", c(), G.id),
1280+
UpperDotAccess(G.upper_id, ".", c(), G.id),
12561281
Indexing(G.value_expr, "[", c(), G.expr, "]"),
12571282
SafeIndexing(G.value_expr, "?[", c(), G.expr, "]"),
12581283
G.selector_expr,
12591284
FunCall(
12601285
G.value_expr, Safe("?"),
12611286
"(", c(), List(G.arg, empty_valid=True, sep=","), ")"
12621287
),
1288+
G.constructor_call,
12631289
G.term
12641290
),
12651291

@@ -1323,6 +1349,11 @@ class Tuple(Expr):
13231349
G.id, Safe("?"), "(", c(), G.arg_list, ")"
13241350
),
13251351

1352+
constructor_call=ConstructorCall(
1353+
"new", G.upper_id,
1354+
"(", c(), List(G.arg, empty_valid=True, sep=","), ")"
1355+
),
1356+
13261357
arg_list=List(G.arg, empty_valid=True, sep=","),
13271358

13281359
selector_decl=SelectorDecl(

0 commit comments

Comments
 (0)