summaryrefslogtreecommitdiffstats
path: root/llparse-frontend/test/fixtures/a-implementation
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
commit0b6210cd37b68b94252cb798598b12974a20e1c1 (patch)
treee371686554a877842d95aa94f100bee552ff2a8e /llparse-frontend/test/fixtures/a-implementation
parentInitial commit. (diff)
downloadnode-undici-upstream.tar.xz
node-undici-upstream.zip
Adding upstream version 5.28.2+dfsg1+~cs23.11.12.3.upstream/5.28.2+dfsg1+_cs23.11.12.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'llparse-frontend/test/fixtures/a-implementation')
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/and.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/base.ts6
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/index.ts15
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/is-equal.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/load.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/match.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/mul-add.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/or.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/span.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/store.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/test.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/update.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/code/value.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/index.ts5
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/base.ts38
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/consume.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/empty.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/error.ts10
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/index.ts15
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/invoke.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/pause.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/sequence.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/single.ts18
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/span-end.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/span-start.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/node/table-lookup.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/transform/base.ts6
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/transform/id.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/transform/index.ts5
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/transform/to-lower-unsafe.ts8
-rw-r--r--llparse-frontend/test/fixtures/a-implementation/transform/to-lower.ts8
31 files changed, 294 insertions, 0 deletions
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/and.ts b/llparse-frontend/test/fixtures/a-implementation/code/and.ts
new file mode 100644
index 0000000..c1df821
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/and.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class And extends Code<code.And> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/base.ts b/llparse-frontend/test/fixtures/a-implementation/code/base.ts
new file mode 100644
index 0000000..d9a7ace
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/base.ts
@@ -0,0 +1,6 @@
+export abstract class Code<T> {
+ constructor(public readonly ref: T) {
+ }
+
+ public abstract build(): string;
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/index.ts b/llparse-frontend/test/fixtures/a-implementation/code/index.ts
new file mode 100644
index 0000000..855a5cf
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/index.ts
@@ -0,0 +1,15 @@
+import { And } from './and';
+import { IsEqual } from './is-equal';
+import { Load } from './load';
+import { Match } from './match';
+import { MulAdd } from './mul-add';
+import { Or } from './or';
+import { Span } from './span';
+import { Store } from './store';
+import { Test } from './test';
+import { Update } from './update';
+import { Value } from './value';
+
+export default {
+ And, IsEqual, Load, Match, MulAdd, Or, Span, Store, Test, Update, Value,
+};
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/is-equal.ts b/llparse-frontend/test/fixtures/a-implementation/code/is-equal.ts
new file mode 100644
index 0000000..13a1737
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/is-equal.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class IsEqual extends Code<code.IsEqual> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/load.ts b/llparse-frontend/test/fixtures/a-implementation/code/load.ts
new file mode 100644
index 0000000..bc97f27
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/load.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Load extends Code<code.Load> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/match.ts b/llparse-frontend/test/fixtures/a-implementation/code/match.ts
new file mode 100644
index 0000000..e933a71
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/match.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Match extends Code<code.Match> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/mul-add.ts b/llparse-frontend/test/fixtures/a-implementation/code/mul-add.ts
new file mode 100644
index 0000000..e06a217
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/mul-add.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class MulAdd extends Code<code.MulAdd> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/or.ts b/llparse-frontend/test/fixtures/a-implementation/code/or.ts
new file mode 100644
index 0000000..a569db4
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/or.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Or extends Code<code.Or> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/span.ts b/llparse-frontend/test/fixtures/a-implementation/code/span.ts
new file mode 100644
index 0000000..46fc410
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/span.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Span extends Code<code.Span> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/store.ts b/llparse-frontend/test/fixtures/a-implementation/code/store.ts
new file mode 100644
index 0000000..7a1ca9f
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/store.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Store extends Code<code.Store> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/test.ts b/llparse-frontend/test/fixtures/a-implementation/code/test.ts
new file mode 100644
index 0000000..4fc8ddb
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/test.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Test extends Code<code.Test> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/update.ts b/llparse-frontend/test/fixtures/a-implementation/code/update.ts
new file mode 100644
index 0000000..16b20e2
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/update.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Update extends Code<code.Update> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/code/value.ts b/llparse-frontend/test/fixtures/a-implementation/code/value.ts
new file mode 100644
index 0000000..8e76e2a
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/code/value.ts
@@ -0,0 +1,8 @@
+import { code } from '../../../../src/frontend';
+import { Code } from './base';
+
+export class Value extends Code<code.Value> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/index.ts b/llparse-frontend/test/fixtures/a-implementation/index.ts
new file mode 100644
index 0000000..1d8d29a
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/index.ts
@@ -0,0 +1,5 @@
+import code from './code';
+import node from './node';
+import transform from './transform';
+
+export default { code, node, transform };
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/base.ts b/llparse-frontend/test/fixtures/a-implementation/node/base.ts
new file mode 100644
index 0000000..04c8285
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/base.ts
@@ -0,0 +1,38 @@
+import { ContainerWrap, node } from '../../../../src/frontend';
+
+export abstract class Node<T extends node.Node> {
+ private built: boolean = false;
+
+ constructor(public readonly ref: T) {
+ }
+
+ public build(out: string[]): void {
+ if (this.built) {
+ return;
+ }
+
+ this.built = true;
+ this.doBuild(out);
+
+ if (this.ref.otherwise !== undefined) {
+ const cwrap = this.ref.otherwise.node as ContainerWrap<T>;
+ const otherwise = cwrap.get<Node<T>>('a');
+ otherwise.build(out);
+ }
+ }
+
+ protected format(value: string): string {
+ let otherwise: string = '';
+ if (this.ref.otherwise !== undefined) {
+ const otherwiseRef = this.ref.otherwise.node.ref;
+ otherwise = ' otherwise' +
+ `${this.ref.otherwise.noAdvance ? '-no_adv' : ''}=` +
+ `${otherwiseRef.id.name}`;
+ }
+
+ return `<${this.constructor.name} name=${this.ref.id.name} ` +
+ `${value}${otherwise}/>`;
+ }
+
+ protected abstract doBuild(out: string[]): void;
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/consume.ts b/llparse-frontend/test/fixtures/a-implementation/node/consume.ts
new file mode 100644
index 0000000..cdc6cef
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/consume.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class Consume extends Node<node.Consume> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(`field=${this.ref.field}`));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/empty.ts b/llparse-frontend/test/fixtures/a-implementation/node/empty.ts
new file mode 100644
index 0000000..ef1499b
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/empty.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class Empty extends Node<node.Empty> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(''));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/error.ts b/llparse-frontend/test/fixtures/a-implementation/node/error.ts
new file mode 100644
index 0000000..1a4f31d
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/error.ts
@@ -0,0 +1,10 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+class ErrorNode extends Node<node.Error> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(`code=${this.ref.code} reason="${this.ref.reason}"`));
+ }
+}
+
+export { ErrorNode as Error };
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/index.ts b/llparse-frontend/test/fixtures/a-implementation/node/index.ts
new file mode 100644
index 0000000..31dbc5e
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/index.ts
@@ -0,0 +1,15 @@
+import { Consume } from './consume';
+import { Empty } from './empty';
+import { Error } from './error';
+import { Invoke } from './invoke';
+import { Pause } from './pause';
+import { Sequence } from './sequence';
+import { Single } from './single';
+import { SpanEnd } from './span-end';
+import { SpanStart } from './span-start';
+import { TableLookup } from './table-lookup';
+
+export default {
+ Consume, Empty, Error, Invoke, Pause, Sequence, Single, SpanEnd,
+ SpanStart, TableLookup,
+};
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/invoke.ts b/llparse-frontend/test/fixtures/a-implementation/node/invoke.ts
new file mode 100644
index 0000000..674be5f
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/invoke.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class Invoke extends Node<node.Invoke> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(''));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/pause.ts b/llparse-frontend/test/fixtures/a-implementation/node/pause.ts
new file mode 100644
index 0000000..94da63c
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/pause.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class Pause extends Node<node.Pause> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(''));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/sequence.ts b/llparse-frontend/test/fixtures/a-implementation/node/sequence.ts
new file mode 100644
index 0000000..13fd336
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/sequence.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class Sequence extends Node<node.Sequence> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(`select="${this.ref.select.toString('hex')}"`));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/single.ts b/llparse-frontend/test/fixtures/a-implementation/node/single.ts
new file mode 100644
index 0000000..d7bcc72
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/single.ts
@@ -0,0 +1,18 @@
+import { ContainerWrap, node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class Single extends Node<node.Single> {
+ protected doBuild(out: string[]): void {
+ const edges: string[] = [];
+ for (const edge of this.ref.edges) {
+ edges.push(`k${edge.key}${edge.noAdvance ? '-no_adv-' : ''}=` +
+ `${edge.node.ref.id.name}`);
+ }
+ out.push(this.format(edges.join(' ')));
+
+ for (const edge of this.ref.edges) {
+ const edgeNode = edge.node as ContainerWrap<node.Node>;
+ edgeNode.get<Node<node.Node>>('a').build(out);
+ }
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/span-end.ts b/llparse-frontend/test/fixtures/a-implementation/node/span-end.ts
new file mode 100644
index 0000000..dc79b81
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/span-end.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class SpanEnd extends Node<node.SpanEnd> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(''));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/span-start.ts b/llparse-frontend/test/fixtures/a-implementation/node/span-start.ts
new file mode 100644
index 0000000..32e373c
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/span-start.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class SpanStart extends Node<node.SpanStart> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(''));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/node/table-lookup.ts b/llparse-frontend/test/fixtures/a-implementation/node/table-lookup.ts
new file mode 100644
index 0000000..e6166d0
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/node/table-lookup.ts
@@ -0,0 +1,8 @@
+import { node } from '../../../../src/frontend';
+import { Node } from './base';
+
+export class TableLookup extends Node<node.TableLookup> {
+ protected doBuild(out: string[]): void {
+ out.push(this.format(''));
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/transform/base.ts b/llparse-frontend/test/fixtures/a-implementation/transform/base.ts
new file mode 100644
index 0000000..96dc27d
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/transform/base.ts
@@ -0,0 +1,6 @@
+export abstract class Transform<T> {
+ constructor(public readonly ref: T) {
+ }
+
+ public abstract build(): string;
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/transform/id.ts b/llparse-frontend/test/fixtures/a-implementation/transform/id.ts
new file mode 100644
index 0000000..e6c1adc
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/transform/id.ts
@@ -0,0 +1,8 @@
+import { transform } from '../../../../src/frontend';
+import { Transform } from './base';
+
+export class ID extends Transform<transform.ID> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/transform/index.ts b/llparse-frontend/test/fixtures/a-implementation/transform/index.ts
new file mode 100644
index 0000000..bed8bc9
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/transform/index.ts
@@ -0,0 +1,5 @@
+import { ID } from './id';
+import { ToLower } from './to-lower';
+import { ToLowerUnsafe } from './to-lower-unsafe';
+
+export default { ID, ToLower, ToLowerUnsafe };
diff --git a/llparse-frontend/test/fixtures/a-implementation/transform/to-lower-unsafe.ts b/llparse-frontend/test/fixtures/a-implementation/transform/to-lower-unsafe.ts
new file mode 100644
index 0000000..9d175a9
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/transform/to-lower-unsafe.ts
@@ -0,0 +1,8 @@
+import { transform } from '../../../../src/frontend';
+import { Transform } from './base';
+
+export class ToLowerUnsafe extends Transform<transform.ToLowerUnsafe> {
+ public build(): string {
+ return '';
+ }
+}
diff --git a/llparse-frontend/test/fixtures/a-implementation/transform/to-lower.ts b/llparse-frontend/test/fixtures/a-implementation/transform/to-lower.ts
new file mode 100644
index 0000000..cbe6456
--- /dev/null
+++ b/llparse-frontend/test/fixtures/a-implementation/transform/to-lower.ts
@@ -0,0 +1,8 @@
+import { transform } from '../../../../src/frontend';
+import { Transform } from './base';
+
+export class ToLower extends Transform<transform.ToLower> {
+ public build(): string {
+ return '';
+ }
+}