@arikajs/view 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +92 -194
  2. package/dist/Compiler/AST.d.ts +34 -0
  3. package/dist/Compiler/AST.d.ts.map +1 -0
  4. package/dist/Compiler/AST.js +12 -0
  5. package/dist/Compiler/AST.js.map +1 -0
  6. package/dist/Compiler/CodeGenerator.d.ts +11 -0
  7. package/dist/Compiler/CodeGenerator.d.ts.map +1 -0
  8. package/dist/Compiler/CodeGenerator.js +53 -0
  9. package/dist/Compiler/CodeGenerator.js.map +1 -0
  10. package/dist/Compiler/DirectiveRegistry.d.ts +10 -0
  11. package/dist/Compiler/DirectiveRegistry.d.ts.map +1 -0
  12. package/dist/Compiler/DirectiveRegistry.js +206 -0
  13. package/dist/Compiler/DirectiveRegistry.js.map +1 -0
  14. package/dist/Compiler/Lexer.d.ts +28 -0
  15. package/dist/Compiler/Lexer.d.ts.map +1 -0
  16. package/dist/Compiler/Lexer.js +209 -0
  17. package/dist/Compiler/Lexer.js.map +1 -0
  18. package/dist/Compiler/Parser.d.ts +15 -0
  19. package/dist/Compiler/Parser.d.ts.map +1 -0
  20. package/dist/Compiler/Parser.js +188 -0
  21. package/dist/Compiler/Parser.js.map +1 -0
  22. package/dist/Compiler.d.ts +4 -3
  23. package/dist/Compiler.d.ts.map +1 -1
  24. package/dist/Compiler.js +13 -60
  25. package/dist/Compiler.js.map +1 -1
  26. package/dist/Engine.d.ts +47 -4
  27. package/dist/Engine.d.ts.map +1 -1
  28. package/dist/Engine.js +203 -39
  29. package/dist/Engine.js.map +1 -1
  30. package/dist/Template.js +1 -1
  31. package/dist/Template.js.map +1 -1
  32. package/dist/View.d.ts +19 -3
  33. package/dist/View.d.ts.map +1 -1
  34. package/dist/View.js +30 -2
  35. package/dist/View.js.map +1 -1
  36. package/dist/src/Compiler/AST.d.ts +34 -0
  37. package/dist/src/Compiler/AST.d.ts.map +1 -0
  38. package/dist/src/Compiler/AST.js +12 -0
  39. package/dist/src/Compiler/AST.js.map +1 -0
  40. package/dist/src/Compiler/CodeGenerator.d.ts +11 -0
  41. package/dist/src/Compiler/CodeGenerator.d.ts.map +1 -0
  42. package/dist/src/Compiler/CodeGenerator.js +53 -0
  43. package/dist/src/Compiler/CodeGenerator.js.map +1 -0
  44. package/dist/src/Compiler/DirectiveRegistry.d.ts +10 -0
  45. package/dist/src/Compiler/DirectiveRegistry.d.ts.map +1 -0
  46. package/dist/src/Compiler/DirectiveRegistry.js +206 -0
  47. package/dist/src/Compiler/DirectiveRegistry.js.map +1 -0
  48. package/dist/src/Compiler/Lexer.d.ts +28 -0
  49. package/dist/src/Compiler/Lexer.d.ts.map +1 -0
  50. package/dist/src/Compiler/Lexer.js +209 -0
  51. package/dist/src/Compiler/Lexer.js.map +1 -0
  52. package/dist/src/Compiler/Parser.d.ts +15 -0
  53. package/dist/src/Compiler/Parser.d.ts.map +1 -0
  54. package/dist/src/Compiler/Parser.js +188 -0
  55. package/dist/src/Compiler/Parser.js.map +1 -0
  56. package/dist/src/Compiler.d.ts +14 -0
  57. package/dist/src/Compiler.d.ts.map +1 -0
  58. package/dist/src/Compiler.js +31 -0
  59. package/dist/src/Compiler.js.map +1 -0
  60. package/dist/src/Engine.d.ts +76 -0
  61. package/dist/src/Engine.d.ts.map +1 -0
  62. package/dist/src/Engine.js +308 -0
  63. package/dist/src/Engine.js.map +1 -0
  64. package/dist/src/Template.d.ts +14 -0
  65. package/dist/src/Template.d.ts.map +1 -0
  66. package/dist/src/Template.js +63 -0
  67. package/dist/src/Template.js.map +1 -0
  68. package/dist/src/View.d.ts +30 -0
  69. package/dist/src/View.d.ts.map +1 -0
  70. package/dist/src/View.js +51 -0
  71. package/dist/src/View.js.map +1 -0
  72. package/dist/tests/View.test.d.ts +2 -0
  73. package/dist/tests/View.test.d.ts.map +1 -0
  74. package/dist/tests/View.test.js +190 -0
  75. package/dist/tests/View.test.js.map +1 -0
  76. package/package.json +45 -43
  77. package/dist/Directives/For.d.ts +0 -5
  78. package/dist/Directives/For.d.ts.map +0 -1
  79. package/dist/Directives/For.js +0 -18
  80. package/dist/Directives/For.js.map +0 -1
  81. package/dist/Directives/If.d.ts +0 -6
  82. package/dist/Directives/If.d.ts.map +0 -1
  83. package/dist/Directives/If.js +0 -26
  84. package/dist/Directives/If.js.map +0 -1
  85. package/dist/Directives/Include.d.ts +0 -5
  86. package/dist/Directives/Include.d.ts.map +0 -1
  87. package/dist/Directives/Include.js +0 -15
  88. package/dist/Directives/Include.js.map +0 -1
  89. package/dist/Directives/Section.d.ts +0 -5
  90. package/dist/Directives/Section.d.ts.map +0 -1
  91. package/dist/Directives/Section.js +0 -28
  92. package/dist/Directives/Section.js.map +0 -1
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DirectiveRegistry = void 0;
4
+ class DirectiveRegistry {
5
+ constructor() {
6
+ this.directives = new Map();
7
+ this.registerDefaultDirectives();
8
+ }
9
+ register(name, handler) {
10
+ this.directives.set(name, handler);
11
+ }
12
+ has(name) {
13
+ return this.directives.has(name);
14
+ }
15
+ handle(name, expression, children) {
16
+ const handler = this.directives.get(name);
17
+ if (handler) {
18
+ return handler(expression, children);
19
+ }
20
+ return null;
21
+ }
22
+ registerDefaultDirectives() {
23
+ // Conditionals
24
+ this.register('if', (exp, children) => `if (${exp}) {\n${children}\n}`);
25
+ this.register('elseif', (exp) => `} else if (${exp}) {`);
26
+ this.register('else', () => `} else {`);
27
+ this.register('unless', (exp, children) => `if (!(${exp})) {\n${children}\n}`);
28
+ this.register('empty', (exp, children) => `if (!(${exp}) || (Array.isArray(${exp}) && ${exp}.length === 0)) {\n${children}\n}`);
29
+ // Loops
30
+ this.register('for', (exp, children) => `for (${exp}) {\n${children}\n}`);
31
+ this.register('each', (exp, children) => {
32
+ // @each('view', data, 'item', 'empty')
33
+ const args = exp?.split(',').map(a => a.trim()) || [];
34
+ const view = args[0];
35
+ const collection = args[1];
36
+ const item = args[2] ? args[2].replace(/['"]/g, '') : 'item';
37
+ const emptyView = args[3];
38
+ return `
39
+ const __items = ${collection};
40
+ if (__items && __items.length > 0) {
41
+ for (const ${item} of __items) {
42
+ _output += await _engine.render(${view}, { ..._data, ${item} }, true);
43
+ }
44
+ } else if (${emptyView}) {
45
+ _output += await _engine.render(${emptyView}, _data, true);
46
+ }
47
+ `;
48
+ });
49
+ this.register('break', (exp) => exp ? `if (${exp}) break;` : 'break;');
50
+ this.register('continue', (exp) => exp ? `if (${exp}) continue;` : 'continue;');
51
+ // Switch
52
+ this.register('switch', (exp, children) => `switch (${exp}) {\n${children}\n}`);
53
+ this.register('case', (exp) => `case ${exp}:`);
54
+ this.register('default', () => `default:`);
55
+ // Layouts & Includes
56
+ this.register('extends', (exp) => `_engine.extend(${exp});`);
57
+ this.register('include', (exp) => `_output += await _engine.render(${exp}, _data, true);`);
58
+ this.register('yield', (exp) => `_output += _engine.yield(${exp});`);
59
+ this.register('section', (exp, children) => {
60
+ return `_engine.startSection(${exp}, _output); _output = "";\n${children}\n _output = _engine.popSection(_output);`;
61
+ });
62
+ // Stacks
63
+ this.register('push', (exp, children) => {
64
+ return `_engine.startPush(${exp}, _output); _output = "";\n${children}\n _output = _engine.endPush(_output);`;
65
+ });
66
+ this.register('prepend', (exp, children) => {
67
+ return `_engine.startPrepend(${exp}, _output); _output = "";\n${children}\n _output = _engine.endPrepend(_output);`;
68
+ });
69
+ this.register('stack', (exp) => `_output += _engine.stack(${exp});`);
70
+ // Components
71
+ this.register('component', (exp, children) => {
72
+ return `_engine.startComponent(${exp}, _output); _output = "";\n${children}\n _output = await _engine.renderComponent(_output);`;
73
+ });
74
+ this.register('slot', (exp, children) => {
75
+ return `_engine.startSlot(${exp}, _output); _output = "";\n${children}\n _output = _engine.endSlot(_output);`;
76
+ });
77
+ // Security & Utils
78
+ this.register('verbatim', (exp, children) => `_output += \`${children?.replace(/`/g, '\\`').replace(/\${/g, '\\${')}\`;`);
79
+ this.register('once', (exp, children) => {
80
+ const id = Math.random().toString(36).substring(7);
81
+ return `if (!_engine.hasOnce('${id}')) { _engine.markOnce('${id}'); ${children} }`;
82
+ });
83
+ // Auth Integration
84
+ this.register('auth', (exp, children) => `if (_data.user) {\n${children}\n}`);
85
+ this.register('guest', (exp, children) => `if (!_data.user) {\n${children}\n}`);
86
+ // Authorization (@can / @cannot / @canany)
87
+ this.register('can', (exp, children) => `if (_data.__can && await _data.__can(${exp})) {\n${children}\n}`);
88
+ this.register('cannot', (exp, children) => `if (!_data.__can || !(await _data.__can(${exp}))) {\n${children}\n}`);
89
+ this.register('canany', (exp, children) => {
90
+ return `{
91
+ const __perms = Array.isArray(${exp}) ? ${exp} : [${exp}];
92
+ const __canAny = _data.__can ? (await Promise.all(__perms.map(p => _data.__can(p)))).some(Boolean) : false;
93
+ if (__canAny) {\n${children}\n}
94
+ }`;
95
+ });
96
+ // Async
97
+ this.register('await', (exp, children) => {
98
+ return `_output += await (${exp});`;
99
+ });
100
+ this.register('json', (exp) => `_output += JSON.stringify(${exp});`);
101
+ // HTMX / Fragments
102
+ this.register('fragment', (exp, children) => {
103
+ return `if (!_engine.isFragmentMode() || _engine.getFragment() === ${exp}) {\n${children}\n}`;
104
+ });
105
+ // --- FORM HELPERS ---
106
+ // @csrf -> hidden input with CSRF token from _data._csrf
107
+ this.register('csrf', () => '_output += `<input type="hidden" name="_token" value="${(_data._csrf || "")}">`;');
108
+ // @method('PUT') -> hidden method spoofing input
109
+ this.register('method', (exp) => `_output += \`<input type="hidden" name="_method" value="\${${exp}}">\`;`);
110
+ // @error('field') ... @enderror
111
+ this.register('error', (exp, children) => {
112
+ return `{
113
+ const __fieldErrors = _data.errors && _data.errors[${exp}];
114
+ if (__fieldErrors) {
115
+ const message = Array.isArray(__fieldErrors) ? __fieldErrors[0] : __fieldErrors;
116
+ ${children}
117
+ }
118
+ }`;
119
+ });
120
+ // --- CONDITIONAL ATTRIBUTES ---
121
+ this.register('checked', (exp) => `_output += (${exp}) ? ' checked' : '';`);
122
+ this.register('selected', (exp) => `_output += (${exp}) ? ' selected' : '';`);
123
+ this.register('disabled', (exp) => `_output += (${exp}) ? ' disabled' : '';`);
124
+ this.register('required', (exp) => `_output += (${exp}) ? ' required' : '';`);
125
+ this.register('readonly', (exp) => `_output += (${exp}) ? ' readonly' : '';`);
126
+ // @class({'cls-a': condition, 'cls-b': true})
127
+ this.register('class', (exp) => {
128
+ return `{
129
+ const __classMap = ${exp};
130
+ const __classes = Object.entries(__classMap).filter(([, v]) => Boolean(v)).map(([c]) => c).join(' ');
131
+ _output += __classes ? \` class="\${__classes}"\` : '';
132
+ }`;
133
+ });
134
+ // @style({'color:red': condition})
135
+ this.register('style', (exp) => {
136
+ return `{
137
+ const __styleMap = ${exp};
138
+ const __styles = Object.entries(__styleMap).filter(([, v]) => Boolean(v)).map(([s]) => s).join('; ');
139
+ _output += __styles ? \` style="\${__styles}"\` : '';
140
+ }`;
141
+ });
142
+ // --- EXISTENCE CHECKS ---
143
+ this.register('isset', (exp, children) => `if (typeof ${exp} !== 'undefined' && ${exp} !== null) {\n${children}\n}`);
144
+ this.register('unset', (exp, children) => `if (typeof ${exp} === 'undefined' || ${exp} === null) {\n${children}\n}`);
145
+ // --- ENVIRONMENT ---
146
+ this.register('env', (exp, children) => {
147
+ return `{
148
+ const __envs = Array.isArray(${exp}) ? ${exp} : [${exp}];
149
+ const __currentEnv = (_data.__env || process.env.NODE_ENV || 'production');
150
+ if (__envs.includes(__currentEnv)) {\n${children}\n}
151
+ }`;
152
+ });
153
+ this.register('production', (exp, children) => {
154
+ return `if ((_data.__env || process.env.NODE_ENV) === 'production') {\n${children}\n}`;
155
+ });
156
+ // --- FORELSE ---
157
+ // @forelse(collection as item) ... @empty ... @endforelse
158
+ this.register('forelse', (exp, children) => {
159
+ const emptyMarker = '/* __FORELSE_EMPTY__ */';
160
+ const parts = (children || '').split(emptyMarker);
161
+ const loopBody = parts[0] || '';
162
+ const emptyBody = parts[1] || '';
163
+ const match = (exp || '').match(/(.+?)\s+as\s+(\S+)(?:\s*,\s*(\S+))?/);
164
+ if (!match)
165
+ return `/* @forelse: invalid expression */`;
166
+ const collection = match[1].replace(/^\$/, '');
167
+ const value = match[2].replace(/^\$/, '');
168
+ const key = match[3]?.replace(/^\$/, '');
169
+ const loopHead = key
170
+ ? `for (const [${key}, ${value}] of Object.entries(__fc)) {`
171
+ : `for (const ${value} of __fc) {`;
172
+ return `{
173
+ const __fc = ${collection} || [];
174
+ const __fcHas = Array.isArray(__fc) ? __fc.length > 0 : Object.keys(__fc).length > 0;
175
+ if (__fcHas) {
176
+ ${loopHead}
177
+ ${loopBody}
178
+ }
179
+ } else {
180
+ ${emptyBody}
181
+ }
182
+ }`;
183
+ });
184
+ // @empty inside @forelse - inserts split marker; standalone @empty(collection) as before
185
+ this.register('empty', (exp, children) => {
186
+ if (!exp && children === undefined) {
187
+ return '/* __FORELSE_EMPTY__ */';
188
+ }
189
+ if (exp) {
190
+ return `if (!(${exp}) || (Array.isArray(${exp}) && ${exp}.length === 0)) {\n${children}\n}`;
191
+ }
192
+ return `/* __FORELSE_EMPTY__ */ ${children || ''}`;
193
+ });
194
+ // --- TRANSLATION ---
195
+ this.register('lang', (exp) => `_output += _escape((_data.__t && _data.__t(${exp})) || ${exp});`);
196
+ this.register('t', (exp) => `_output += _escape((_data.__t && _data.__t(${exp})) || ${exp});`);
197
+ this.register('choice', (exp) => {
198
+ const args = exp?.split(',').map(a => a.trim()) || [];
199
+ const key = args[0];
200
+ const count = args[1] || '1';
201
+ return `_output += _escape((_data.__choice && _data.__choice(${key}, ${count})) || ${key});`;
202
+ });
203
+ }
204
+ }
205
+ exports.DirectiveRegistry = DirectiveRegistry;
206
+ //# sourceMappingURL=DirectiveRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectiveRegistry.js","sourceRoot":"","sources":["../../src/Compiler/DirectiveRegistry.ts"],"names":[],"mappings":";;;A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ive",// @directive(expr) or @directive
6
+ ComponentStart = "ComponentStart",// <x-component
7
+ ComponentEnd = "ComponentEnd"
8
+ }
9
+ export interface Token {
10
+ type: TokenType;
11
+ value: string;
12
+ line: number;
13
+ }
14
+ export declare class Lexer {
15
+ private input;
16
+ private position;
17
+ private line;
18
+ constructor(input: string);
19
+ tokenize(): Token[];
20
+ private consumeRawExpression;
21
+ private consumeExpression;
22
+ private consumeDirective;
23
+ private consumeComponentStart;
24
+ private consumeComponentEnd;
25
+ private consumeComment;
26
+ private consumeText;
27
+ }
28
+ //# sourceMappingURL=Lexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lexer.d.ts","sourceRoot":"","sources":["../../src/Compiler/Lexer.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACjB,IAAI,SAAS;IACb,UAAU,eAAe,CAAS,aAAa;IAC/C,aAAa,kBAAkB,CAAI,eAAe;IAClD,SAAS,cAAc,CAAY,iCAAiC;IACpE,cAAc,mBAAmB,CAAE,eAAe;IAClD,YAAY,iBAAiB;CAChC;AAED,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,KAAK;IACd,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,IAAI,CAAa;gBAEb,KAAK,EAAE,MAAM;IAIlB,QAAQ,IAAI,KAAK,EAAE;IAwE1B,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,gBAAgB;IAqCxB,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,WAAW;CAqBtB"}
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Lexer = exports.TokenType = void 0;
4
+ var TokenType;
5
+ (function (TokenType) {
6
+ TokenType["Text"] = "Text";
7
+ TokenType["Expression"] = "Expression";
8
+ TokenType["RawExpression"] = "RawExpression";
9
+ TokenType["Directive"] = "Directive";
10
+ TokenType["ComponentStart"] = "ComponentStart";
11
+ TokenType["ComponentEnd"] = "ComponentEnd";
12
+ })(TokenType || (exports.TokenType = TokenType = {}));
13
+ class Lexer {
14
+ constructor(input) {
15
+ this.position = 0;
16
+ this.line = 1;
17
+ this.input = input;
18
+ }
19
+ tokenize() {
20
+ const tokens = [];
21
+ while (this.position < this.input.length) {
22
+ const char = this.input[this.position];
23
+ // Raw Expression {!! ... !!}
24
+ if (this.input.startsWith('{!!', this.position)) {
25
+ tokens.push(this.consumeRawExpression());
26
+ continue;
27
+ }
28
+ // Comment {{-- ... --}}
29
+ if (this.input.startsWith('{{--', this.position)) {
30
+ this.consumeComment();
31
+ continue;
32
+ }
33
+ // Expression {{ ... }}
34
+ if (this.input.startsWith('{{', this.position)) {
35
+ tokens.push(this.consumeExpression());
36
+ continue;
37
+ }
38
+ // Component End </x-
39
+ if (this.input.startsWith('</x-', this.position)) {
40
+ tokens.push(this.consumeComponentEnd());
41
+ continue;
42
+ }
43
+ // Component Start <x-
44
+ if (this.input.startsWith('<x-', this.position)) {
45
+ tokens.push(this.consumeComponentStart());
46
+ continue;
47
+ }
48
+ // Directive @...
49
+ if (char === '@') {
50
+ // Peek if it's an escaped @@
51
+ if (this.input[this.position + 1] === '@') {
52
+ tokens.push({ type: TokenType.Text, value: '@', line: this.line });
53
+ this.position += 2;
54
+ continue;
55
+ }
56
+ // Peek to see if it's a valid directive name (following letters)
57
+ const nextChar = this.input[this.position + 1];
58
+ if (nextChar && /[a-zA-Z]/.test(nextChar)) {
59
+ tokens.push(this.consumeDirective());
60
+ continue;
61
+ }
62
+ else {
63
+ // Not a directive, treat as regular text
64
+ tokens.push({ type: TokenType.Text, value: '@', line: this.line });
65
+ this.position++;
66
+ continue;
67
+ }
68
+ }
69
+ // Otherwise, it's text
70
+ const textToken = this.consumeText();
71
+ if (textToken.value.length > 0) {
72
+ tokens.push(textToken);
73
+ }
74
+ else if (this.position < this.input.length) {
75
+ // Avoid infinite loop if no other token matches but position didn't advance
76
+ const char = this.input[this.position];
77
+ tokens.push({ type: TokenType.Text, value: char, line: this.line });
78
+ if (char === '\n')
79
+ this.line++;
80
+ this.position++;
81
+ }
82
+ }
83
+ return tokens;
84
+ }
85
+ consumeRawExpression() {
86
+ const start = this.position;
87
+ this.position += 3; // {!!
88
+ while (this.position < this.input.length && !this.input.startsWith('!!}', this.position)) {
89
+ if (this.input[this.position] === '\n')
90
+ this.line++;
91
+ this.position++;
92
+ }
93
+ this.position += 3; // !!}
94
+ return {
95
+ type: TokenType.RawExpression,
96
+ value: this.input.substring(start + 3, this.position - 3).trim(),
97
+ line: this.line
98
+ };
99
+ }
100
+ consumeExpression() {
101
+ const start = this.position;
102
+ this.position += 2; // {{
103
+ while (this.position < this.input.length && !this.input.startsWith('}}', this.position)) {
104
+ if (this.input[this.position] === '\n')
105
+ this.line++;
106
+ this.position++;
107
+ }
108
+ this.position += 2; // }}
109
+ return {
110
+ type: TokenType.Expression,
111
+ value: this.input.substring(start + 2, this.position - 2).trim(),
112
+ line: this.line
113
+ };
114
+ }
115
+ consumeDirective() {
116
+ const start = this.position;
117
+ this.position++; // @
118
+ while (this.position < this.input.length && /[a-zA-Z0-9_]/.test(this.input[this.position])) {
119
+ this.position++;
120
+ }
121
+ let value = this.input.substring(start, this.position);
122
+ // Check for expression @directive(...)
123
+ // Allow optional whitespace before the parenthesis
124
+ let tempPos = this.position;
125
+ while (tempPos < this.input.length && (this.input[tempPos] === ' ' || this.input[tempPos] === '\t')) {
126
+ tempPos++;
127
+ }
128
+ if (this.input[tempPos] === '(') {
129
+ this.position = tempPos;
130
+ let parenCount = 1;
131
+ this.position++;
132
+ const exprStart = this.position;
133
+ while (this.position < this.input.length && parenCount > 0) {
134
+ if (this.input[this.position] === '(')
135
+ parenCount++;
136
+ if (this.input[this.position] === ')')
137
+ parenCount--;
138
+ if (this.input[this.position] === '\n')
139
+ this.line++;
140
+ this.position++;
141
+ }
142
+ value = this.input.substring(start, this.position);
143
+ }
144
+ return {
145
+ type: TokenType.Directive,
146
+ value,
147
+ line: this.line
148
+ };
149
+ }
150
+ consumeComponentStart() {
151
+ const start = this.position;
152
+ while (this.position < this.input.length && this.input[this.position] !== '>') {
153
+ if (this.input[this.position] === '\n')
154
+ this.line++;
155
+ this.position++;
156
+ }
157
+ this.position++; // >
158
+ return {
159
+ type: TokenType.ComponentStart,
160
+ value: this.input.substring(start, this.position),
161
+ line: this.line
162
+ };
163
+ }
164
+ consumeComponentEnd() {
165
+ const start = this.position;
166
+ while (this.position < this.input.length && this.input[this.position] !== '>') {
167
+ this.position++;
168
+ }
169
+ this.position++; // >
170
+ return {
171
+ type: TokenType.ComponentEnd,
172
+ value: this.input.substring(start, this.position),
173
+ line: this.line
174
+ };
175
+ }
176
+ consumeComment() {
177
+ this.position += 4; // {{--
178
+ while (this.position < this.input.length && !this.input.startsWith('--}}', this.position)) {
179
+ if (this.input[this.position] === '\n')
180
+ this.line++;
181
+ this.position++;
182
+ }
183
+ this.position += 4; // --}}
184
+ }
185
+ consumeText() {
186
+ const start = this.position;
187
+ while (this.position < this.input.length) {
188
+ const char = this.input[this.position];
189
+ if (char === '@' ||
190
+ this.input.startsWith('{{--', this.position) ||
191
+ this.input.startsWith('{{', this.position) ||
192
+ this.input.startsWith('{!!', this.position) ||
193
+ this.input.startsWith('<x-', this.position) ||
194
+ this.input.startsWith('</x-', this.position)) {
195
+ break;
196
+ }
197
+ if (char === '\n')
198
+ this.line++;
199
+ this.position++;
200
+ }
201
+ return {
202
+ type: TokenType.Text,
203
+ value: this.input.substring(start, this.position),
204
+ line: this.line
205
+ };
206
+ }
207
+ }
208
+ exports.Lexer = Lexer;
209
+ //# sourceMappingURL=Lexer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lexer.js","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BAC/C,MAAM;YACV,CAAC;YACD,IAAI,IAAI,KAAK,IAAI;gBAAE,IAAI,CAAC,IAAI,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpB,CAAC;QACD,OAAO;YACH,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YACjD,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC;IACN,CAAC;CACJ;AA7MD,sBA6MC"}
@@ -0,0 +1,15 @@
1
+ import { Token } from './Lexer';
2
+ import { RootNode } from './AST';
3
+ export declare class Parser {
4
+ private tokens;
5
+ private position;
6
+ constructor(tokens: Token[]);
7
+ parse(): RootNode;
8
+ private parseNode;
9
+ private parseDirective;
10
+ private parseComponent;
11
+ private parseComponentAttributes;
12
+ private isBlockDirective;
13
+ private getEndDirectiveName;
14
+ }
15
+ //# sourceMappingURL=Parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../src/Compiler/Parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAkB,QAAQ,EAAiB,MAAM,OAAO,CAAC;AAEhE,qBAAa,MAAM;IACf,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,QAAQ,CAAa;gBAEjB,MAAM,EAAE,KAAK,EAAE;IAIpB,KAAK,IAAI,QAAQ;IAoBxB,OAAO,CAAC,SAAS;IA8BjB,OAAO,CAAC,cAAc;IA6CtB,OAAO,CAAC,cAAc;IAqCtB,OAAO,CAAC,wBAAwB;IAuBhC,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,mBAAmB;CAoB9B"}