Skip to content

Commit f0d16f0

Browse files
authored
Merge pull request #186 from engalar/fix/keyword-rule-missing-tokens
fix: add 168 missing lexer tokens to keyword rule
2 parents 503cfb6 + 3e7d2d7 commit f0d16f0

8 files changed

Lines changed: 10711 additions & 10241 deletions

File tree

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
-- ============================================================================
2+
-- Keyword-as-Identifier Regression Tests
3+
-- ============================================================================
4+
--
5+
-- Verifies that lexer keyword tokens can be used as identifiers (entity names,
6+
-- attribute names, enum values) via the parser's `keyword` rule.
7+
--
8+
-- Regression test for PR #186 (168 missing tokens) and PR #174 (OPEN fix).
9+
-- See: https://github.com/mendixlabs/mxcli/pull/186
10+
--
11+
-- Usage:
12+
-- mxcli check mdl-examples/doctype-tests/keyword-as-identifier.mdl
13+
--
14+
-- ============================================================================
15+
16+
CREATE MODULE KeywordTest;
17+
18+
-- MARK: Enum values that are lexer keywords
19+
20+
CREATE ENUMERATION KeywordTest.IssueStatus (
21+
Open,
22+
Closed,
23+
Data,
24+
Filter,
25+
Match,
26+
Empty,
27+
Container,
28+
Node
29+
);
30+
31+
CREATE ENUMERATION KeywordTest.HttpMethod (
32+
Get,
33+
Post,
34+
Put,
35+
Delete,
36+
Patch
37+
);
38+
39+
CREATE ENUMERATION KeywordTest.ActivityKind (
40+
Activity,
41+
Condition,
42+
Loop,
43+
Start,
44+
End,
45+
Split,
46+
Join,
47+
Merge
48+
);
49+
50+
CREATE ENUMERATION KeywordTest.LayoutKind (
51+
Layout,
52+
Header,
53+
Footer,
54+
Body,
55+
Content,
56+
Title,
57+
Text,
58+
Image
59+
);
60+
61+
CREATE ENUMERATION KeywordTest.MiscKeywords (
62+
Action,
63+
Source,
64+
Target,
65+
Owner,
66+
Type,
67+
Name,
68+
Value,
69+
Result,
70+
Object,
71+
Index,
72+
Input,
73+
Output,
74+
Sort,
75+
Order,
76+
Commit,
77+
Close,
78+
Refresh,
79+
Rollback
80+
);
81+
82+
-- MARK: Entity names and attributes that are keywords
83+
84+
CREATE ENTITY KeywordTest.Data (
85+
Filter : String(200),
86+
Match : String(200),
87+
Container : String(200),
88+
Source : String(200),
89+
Target : String(200),
90+
Action : String(200),
91+
Value : String(200),
92+
Status : String(200)
93+
);
94+
95+
CREATE ENTITY KeywordTest.Activity (
96+
Name : String(200),
97+
Type : String(200),
98+
Result : String(200)
99+
);
100+
101+
-- MARK: Microflow using keyword-named enum values in CREATE
102+
103+
CREATE OR REPLACE MICROFLOW KeywordTest.TestKeywordEnumValues ()
104+
RETURNS Nothing
105+
BEGIN
106+
$Issue = CREATE KeywordTest.Data (
107+
Filter = 'test',
108+
Match = 'test',
109+
Status = 'active'
110+
);
111+
112+
$Activity = CREATE KeywordTest.Activity (
113+
Name = 'test',
114+
Type = 'task',
115+
Result = 'ok'
116+
);
117+
END;

0 commit comments

Comments
 (0)