From d7d993c743762986ae91bd921b6a93e85ee7e6b2 Mon Sep 17 00:00:00 2001 From: EagleoutIce Date: Wed, 10 Jan 2024 13:41:57 +0100 Subject: [PATCH 01/12] test: more on access tests --- .../ast/parser/xml/v2/internal/access.ts | 7 +- .../ast/parser/xml/v2/internal/internal.ts | 1 + .../r-bridge/lang/ast/parse-access.ts | 103 +++++++++++++----- 3 files changed, 78 insertions(+), 33 deletions(-) create mode 100644 src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/internal.ts diff --git a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts index 513c62b45b..3a45a3b2a4 100644 --- a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts +++ b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts @@ -6,6 +6,7 @@ import { splitArrayOn } from '../../../../../../../util/arrays' import { NormalizeConfiguration } from '../data' import { normalizeSingleToken } from './single-element' import { tryToNormalizeArgument } from './functions/argument' +import {InternalScope} from "./internal"; /** * Normalize the given data as access (e.g., indexing). @@ -53,8 +54,7 @@ export function normalizeAccess(configuration: NormalizeConfiguration, tokens: r flavor: 'named', functionName: { type: RType.Symbol, - // TODO: just lock "internal" here - namespace: undefined, + namespace: InternalScope, lexeme: content, info: {}, content, @@ -84,8 +84,7 @@ export function normalizeAccess(configuration: NormalizeConfiguration, tokens: r flavor: 'named', functionName: { type: RType.Symbol, - // TODO: just lock "internal" here - namespace: undefined, + namespace: InternalScope, lexeme: content, info: {}, content, diff --git a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/internal.ts b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/internal.ts new file mode 100644 index 0000000000..1975767863 --- /dev/null +++ b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/internal.ts @@ -0,0 +1 @@ +export const InternalScope = ".$internal" diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index 7829d245d1..4284b48981 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -3,6 +3,7 @@ import { exprList, numVal } from '../../../_helper/ast-builder' import { rangeFrom } from '../../../../../src/util/range' import { RType } from '../../../../../src/r-bridge' import { DESUGAR_NORMALIZE, NORMALIZE } from '../../../../../src/core/steps/all/core/10-normalize' +import {InternalScope} from "../../../../../src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/internal"; describe('Parse value access', withShell(shell => { describe('Single bracket', () => { @@ -37,7 +38,7 @@ describe('Parse value access', withShell(shell => { content: '[', info: {}, location: rangeFrom(1, 2, 1, 2), - namespace: undefined + namespace: InternalScope }, location: rangeFrom(1, 2, 1, 2), flavor: 'named', @@ -53,35 +54,79 @@ describe('Parse value access', withShell(shell => { }) } ]) - assertAst('One value', shell, 'a[1]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 2), - lexeme: '[', - operator: '[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'a', - content: 'a', - info: {} + assertAst('One value', shell, 'a[1]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 2), + lexeme: '[', + operator: '[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'a', + content: 'a', + info: {} + }, + access: [{ + type: RType.Argument, + location: rangeFrom(1, 3, 1, 3), + lexeme: '1', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 3, 1, 3), + lexeme: '1', + content: numVal(1), + info: {} + } + }] + }) }, - access: [{ - type: RType.Argument, - location: rangeFrom(1, 3, 1, 3), - lexeme: '1', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 3, 1, 3), - lexeme: '1', - content: numVal(1), - info: {} - } - }] - })) + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + info: {}, + lexeme: '[', + functionName: { + type: RType.Symbol, + lexeme: '[', + content: '[', + info: {}, + location: rangeFrom(1, 2, 1, 2), + namespace: InternalScope + }, + location: rangeFrom(1, 2, 1, 2), + flavor: 'named', + arguments: [{ + type: RType.Symbol, + lexeme: 'a', + content: 'a', + info: {}, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined + }, { + type: RType.Argument, + location: rangeFrom(1, 3, 1, 3), + lexeme: '1', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 3, 1, 3), + lexeme: '1', + content: numVal(1), + info: {} + } + }] + }) + } + ]) assertAst('One variable', shell, 'a[x]', exprList({ type: RType.Access, location: rangeFrom(1, 2, 1, 2), From 02793df18592f2564b77383e170bf5a9deb1bf17 Mon Sep 17 00:00:00 2001 From: EagleoutIce Date: Wed, 10 Jan 2024 13:44:50 +0100 Subject: [PATCH 02/12] refactor: remove argument wraps whenever there is no name! --- .../ast/parser/xml/v2/internal/access.ts | 2 +- .../xml/v2/internal/functions/argument.ts | 26 +++++++++++-------- .../r-bridge/lang/ast/parse-access.ts | 13 +++------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts index 3a45a3b2a4..d20ba31f69 100644 --- a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts +++ b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts @@ -99,7 +99,7 @@ export function normalizeAccess(configuration: NormalizeConfiguration, tokens: r } -function normalizeAccessArgument(config: NormalizeConfiguration, elements: readonly XmlBasedJson[]): RArgument { +function normalizeAccessArgument(config: NormalizeConfiguration, elements: readonly XmlBasedJson[]): RNode { const res = tryToNormalizeArgument(config, elements) guard(res !== undefined, () => `expected one access result in access as argument, yet received ${JSON.stringify(res)} for ${JSON.stringify(elements)}`) return res diff --git a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts index 1ad2ded634..c656e0aabb 100644 --- a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts +++ b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts @@ -16,7 +16,7 @@ import { normalizeSingleToken } from '../single-element' * * @returns The parsed argument or `undefined` if the given object is not an argument. */ -export function tryToNormalizeArgument(configuration: NormalizeConfiguration, objs: readonly XmlBasedJson[]): RArgument | undefined { +export function tryToNormalizeArgument(configuration: NormalizeConfiguration, objs: readonly XmlBasedJson[]): RNode | undefined { if(objs.length < 1 || objs.length > 3) { log.warn(`Either [expr|value], [SYMBOL_SUB, EQ_SUB], or [SYMBOL_SUB, EQ_SUB, expr], but got: ${objs.map(o => JSON.stringify(o)).join(', ')}`) return undefined @@ -51,16 +51,20 @@ export function tryToNormalizeArgument(configuration: NormalizeConfiguration, ob guard(parsedValue !== undefined && parsedValue?.type !== RType.Delimiter, () => `[argument] parsed value must not be undefined, yet: ${JSON.stringify(objs)}`) - return { - type: RType.Argument, - location, - lexeme: content, - name, - value: parsedValue ?? undefined, - info: { - fullRange: location, - fullLexeme: content, - additionalTokens: [] + if(name === undefined) { + return parsedValue ?? undefined + } else { + return { + type: RType.Argument, + location, + lexeme: content, + name, + value: parsedValue ?? undefined, + info: { + fullRange: location, + fullLexeme: content, + additionalTokens: [] + } } } } diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index 4284b48981..b267c9c0d0 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -111,18 +111,11 @@ describe('Parse value access', withShell(shell => { location: rangeFrom(1, 1, 1, 1), namespace: undefined }, { - type: RType.Argument, + type: RType.Number, location: rangeFrom(1, 3, 1, 3), lexeme: '1', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 3, 1, 3), - lexeme: '1', - content: numVal(1), - info: {} - } + content: numVal(1), + info: {} }] }) } From e293fe568666385660af7ebcabd1c091d3f8c41d Mon Sep 17 00:00:00 2001 From: EagleoutIce Date: Sat, 13 Jan 2024 13:55:54 +0100 Subject: [PATCH 03/12] wip: current stage --- test/functionality/_helper/shell.ts | 1 + test/functionality/r-bridge/lang/ast/parse-access.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functionality/_helper/shell.ts b/test/functionality/_helper/shell.ts index 9ef73fe7f5..2883172a8a 100644 --- a/test/functionality/_helper/shell.ts +++ b/test/functionality/_helper/shell.ts @@ -26,6 +26,7 @@ import { PipelineExecutor } from '../../../src/core/pipeline-executor' import { PARSE_WITH_R_SHELL_STEP } from '../../../src/core/steps/all/core/00-parse' import { DESUGAR_NORMALIZE, NORMALIZE } from '../../../src/core/steps/all/core/10-normalize' import { DataflowGraph, diffGraphsToMermaidUrl, graphToMermaidUrl } from '../../../src/dataflow/v1' +import {LEGACY_STATIC_DATAFLOW} from "../../../src/core/steps/all/core/20-dataflow"; export const testWithShell = (msg: string, fn: (shell: RShell, test: Mocha.Context) => void | Promise): Mocha.Test => { return it(msg, async function(): Promise { diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index b267c9c0d0..1ed13632fb 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -482,7 +482,6 @@ describe('Parse value access', withShell(shell => { info: {} }, access: [{ - type: RType.Argument, location: rangeFrom(1, 4, 1, 4), lexeme: '5', From 3b893fa79b01084ac80638121d15e48a33680f2a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 16 Jan 2024 11:56:18 +0100 Subject: [PATCH 04/12] test: start on double bracket tests --- .../r-bridge/lang/ast/parse-access.ts | 305 +++++++++++++----- 1 file changed, 219 insertions(+), 86 deletions(-) diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index 7829d245d1..b8d69a8364 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -342,93 +342,227 @@ describe('Parse value access', withShell(shell => { })) }) describe('Double bracket', () => { - assertAst('Empty', shell, 'b[[]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} + assertAst('Empty', shell, 'b[[]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [] + }) }, - access: [] - })) - assertAst('One element', shell, 'b[[5]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + info: {}, + lexeme: '[[', + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + location: rangeFrom(1, 2, 1, 3), + flavor: 'named', + arguments: [{ + type: RType.Symbol, + lexeme: 'b', + content: 'b', + info: {}, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined + }] + }) + } + ]) + assertAst('One element', shell, 'b[[5]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [{ + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }] + }) }, - access: [{ - type: RType.Argument, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } - }] - })) - assertAst('Multiple', shell, 'b[[5,3]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + info: {}, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, { + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }] + }) + } + ]) + assertAst('Multiple', shell, 'b[[5,3]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [{ + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, { + type: RType.Argument, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + content: numVal(3), + info: {} + } + }] + }) }, - access: [{ - type: RType.Argument, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } - }, { - type: RType.Argument, - location: rangeFrom(1, 6, 1, 6), - lexeme: '3', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 6, 1, 6), - lexeme: '3', - content: numVal(3), - info: {} - } - }] - })) + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, { + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, { + // TODO this seems to be unexpected in the actual result - why? + type: RType.Argument, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + content: numVal(3), + info: {} + } + } + ] + }) + } + ]) assertAst('Multiple with empty', shell, 'b[[5,,]]', exprList({ type: RType.Access, location: rangeFrom(1, 2, 1, 3), @@ -457,7 +591,7 @@ describe('Parse value access', withShell(shell => { content: numVal(5), info: {} } - },null,null] + }, null, null] })) }) describe('Dollar and Slot', () => { @@ -495,4 +629,3 @@ describe('Parse value access', withShell(shell => { })) }) })) - From 1f07e04a47b5d8b63050fdaf040acf57139483ab Mon Sep 17 00:00:00 2001 From: Florian Sihler Date: Tue, 16 Jan 2024 11:58:56 +0100 Subject: [PATCH 05/12] feat-fix: v2 access splits `,` after op map, not before :sweat_smile: --- src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts index 513c62b45b..120d29d7c1 100644 --- a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts +++ b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts @@ -70,7 +70,9 @@ export function normalizeAccess(configuration: NormalizeConfiguration, tokens: r // otherwise we have to process const remaining: readonly XmlBasedJson[] = tokens.slice(2, tokens.length - closingLength) - const splitAccessOnComma = splitArrayOn(remaining, elem => elem.name === RawRType.Comma) + const splitAccessOnComma = splitArrayOn(remaining, elem => + getTokenType(configuration.tokenMap, elem) === RawRType.Comma + ) const parsedAccess: (RNode | undefined)[] = splitAccessOnComma.map((elems: readonly XmlBasedJson[]) => elems.length === 0 ? undefined : normalizeAccessArgument(configuration, elems) From ac53686e0320e45342460bd64d06d6a913ebcb7f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 16 Jan 2024 12:07:33 +0100 Subject: [PATCH 06/12] test: resolve todo --- test/functionality/r-bridge/lang/ast/parse-access.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index b8d69a8364..acb64d04ef 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -545,7 +545,6 @@ describe('Parse value access', withShell(shell => { info: {} } }, { - // TODO this seems to be unexpected in the actual result - why? type: RType.Argument, location: rangeFrom(1, 6, 1, 6), lexeme: '3', From 6f48fde59c109917c78f799fe9044c1f2c1c0228 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 16 Jan 2024 12:55:44 +0100 Subject: [PATCH 07/12] test: finished double bracket and dollar and slot tests --- .../r-bridge/lang/ast/parse-access.ts | 238 +++++++++++++----- 1 file changed, 179 insertions(+), 59 deletions(-) diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index acb64d04ef..bc1715b91b 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -562,69 +562,189 @@ describe('Parse value access', withShell(shell => { }) } ]) - assertAst('Multiple with empty', shell, 'b[[5,,]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} - }, - access: [{ + assertAst('Multiple with empty', shell, 'b[[5,,]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [{ - type: RType.Argument, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } - }, null, null] - })) + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, null, null] + }) + }, + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, { + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, undefined, undefined] + }) + } + ]) }) describe('Dollar and Slot', () => { - assertAst('Dollar access', shell, 'c$x', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 2), - lexeme: '$', - operator: '$', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'c', - content: 'c', - info: {} + assertAst('Dollar access', shell, 'c$x', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 2), + lexeme: '$', + operator: '$', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'c', + content: 'c', + info: {} + }, + access: 'x' + }) }, - access: 'x' - })) - assertAst('Slot based access', shell, 'd@y', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 2), - lexeme: '@', - operator: '@', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'd', - content: 'd', - info: {} + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 2), + lexeme: '$', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '$', + content: '$', + info: {}, + location: rangeFrom(1, 2, 1, 2), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'c', + content: 'c', + info: {} + }, { + type: RType.Symbol, + location: rangeFrom(1, 3, 1, 3), + namespace: undefined, + lexeme: 'x', + content: 'x', + info: {} + }] + }) + } + ]) + assertAst('Slot based access', shell, 'd@y', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 2), + lexeme: '@', + operator: '@', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'd', + content: 'd', + info: {} + }, + access: 'y' + }) }, - access: 'y' - })) + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 2), + lexeme: '@', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '@', + content: '@', + info: {}, + location: rangeFrom(1, 2, 1, 2), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'd', + content: 'd', + info: {} + }, { + type: RType.Symbol, + location: rangeFrom(1, 3, 1, 3), + namespace: undefined, + lexeme: 'y', + content: 'y', + info: {} + }] + }) + } + ]) }) })) From 57578e28d70a859d2263150f794f638558a9d9b4 Mon Sep 17 00:00:00 2001 From: EagleoutIce Date: Wed, 17 Jan 2024 10:25:58 +0100 Subject: [PATCH 08/12] lint: handle unused linter issues --- src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts | 2 +- .../lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts | 2 +- test/functionality/_helper/shell.ts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts index 6fc4bf348b..4c394dab9e 100644 --- a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts +++ b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.ts @@ -1,6 +1,6 @@ import { XmlBasedJson, XmlParseError } from '../../common/input-format' import { getTokenType, retrieveMetaStructure } from '../../common/meta' -import { RType, RNode, RArgument, RawRType, RFunctionCall } from '../../../../model' +import { RType, RNode, RawRType, RFunctionCall } from '../../../../model' import { guard } from '../../../../../../../util/assert' import { splitArrayOn } from '../../../../../../../util/arrays' import { NormalizeConfiguration } from '../data' diff --git a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts index 8c93ab0383..8cd4706ec4 100644 --- a/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts +++ b/src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.ts @@ -1,6 +1,6 @@ import { XmlBasedJson, XmlParseError } from '../../../common/input-format' import { getTokenType, retrieveMetaStructure } from '../../../common/meta' -import { RNode, RType, RSymbol, RArgument, RawRType } from '../../../../../model' +import { RNode, RType, RSymbol, RawRType } from '../../../../../model' import { NormalizeConfiguration } from '../../data' import { log } from '../../../../../../../../util/log' import { guard } from '../../../../../../../../util/assert' diff --git a/test/functionality/_helper/shell.ts b/test/functionality/_helper/shell.ts index f105260dae..9ef73fe7f5 100644 --- a/test/functionality/_helper/shell.ts +++ b/test/functionality/_helper/shell.ts @@ -26,7 +26,6 @@ import { PipelineExecutor } from '../../../src/core/pipeline-executor' import { PARSE_WITH_R_SHELL_STEP } from '../../../src/core/steps/all/core/00-parse' import { DESUGAR_NORMALIZE, NORMALIZE } from '../../../src/core/steps/all/core/10-normalize' import { DataflowGraph, diffGraphsToMermaidUrl, graphToMermaidUrl } from '../../../src/dataflow/v1' -import {LEGACY_STATIC_DATAFLOW} from '../../../src/core/steps/all/core/20-dataflow' export const testWithShell = (msg: string, fn: (shell: RShell, test: Mocha.Context) => void | Promise): Mocha.Test => { return it(msg, async function(): Promise { From d6e871f1faf9eadcc126eeeaf139bbd13ef70f50 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 16 Jan 2024 11:56:18 +0100 Subject: [PATCH 09/12] test: start on double bracket tests --- .../r-bridge/lang/ast/parse-access.ts | 305 +++++++++++++----- 1 file changed, 219 insertions(+), 86 deletions(-) diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index fd7fe6924e..6872eae30c 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -380,93 +380,227 @@ describe('Parse value access', withShell(shell => { })) }) describe('Double bracket', () => { - assertAst('Empty', shell, 'b[[]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} + assertAst('Empty', shell, 'b[[]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [] + }) }, - access: [] - })) - assertAst('One element', shell, 'b[[5]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + info: {}, + lexeme: '[[', + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + location: rangeFrom(1, 2, 1, 3), + flavor: 'named', + arguments: [{ + type: RType.Symbol, + lexeme: 'b', + content: 'b', + info: {}, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined + }] + }) + } + ]) + assertAst('One element', shell, 'b[[5]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [{ + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }] + }) }, - access: [{ - type: RType.Argument, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } - }] - })) - assertAst('Multiple', shell, 'b[[5,3]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + info: {}, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, { + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }] + }) + } + ]) + assertAst('Multiple', shell, 'b[[5,3]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [{ + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, { + type: RType.Argument, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + content: numVal(3), + info: {} + } + }] + }) }, - access: [{ - type: RType.Argument, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } - }, { - type: RType.Argument, - location: rangeFrom(1, 6, 1, 6), - lexeme: '3', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 6, 1, 6), - lexeme: '3', - content: numVal(3), - info: {} - } - }] - })) + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, { + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, { + // TODO this seems to be unexpected in the actual result - why? + type: RType.Argument, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 6, 1, 6), + lexeme: '3', + content: numVal(3), + info: {} + } + } + ] + }) + } + ]) assertAst('Multiple with empty', shell, 'b[[5,,]]', exprList({ type: RType.Access, location: rangeFrom(1, 2, 1, 3), @@ -494,7 +628,7 @@ describe('Parse value access', withShell(shell => { content: numVal(5), info: {} } - },null,null] + }, null, null] })) }) describe('Dollar and Slot', () => { @@ -532,4 +666,3 @@ describe('Parse value access', withShell(shell => { })) }) })) - From a9720a20a7b93a0f0a5c34be20a48d3a77b9af84 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 16 Jan 2024 12:07:33 +0100 Subject: [PATCH 10/12] test: resolve todo --- test/functionality/r-bridge/lang/ast/parse-access.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index 6872eae30c..6c4e92eb1d 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -583,7 +583,6 @@ describe('Parse value access', withShell(shell => { info: {} } }, { - // TODO this seems to be unexpected in the actual result - why? type: RType.Argument, location: rangeFrom(1, 6, 1, 6), lexeme: '3', From 5e198493b84c3e774641767dca2e29f89d82f527 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 16 Jan 2024 12:55:44 +0100 Subject: [PATCH 11/12] test: finished double bracket and dollar and slot tests --- .../r-bridge/lang/ast/parse-access.ts | 237 +++++++++++++----- 1 file changed, 179 insertions(+), 58 deletions(-) diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index 6c4e92eb1d..6a91846325 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -600,68 +600,189 @@ describe('Parse value access', withShell(shell => { }) } ]) - assertAst('Multiple with empty', shell, 'b[[5,,]]', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 3), - lexeme: '[[', - operator: '[[', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'b', - content: 'b', - info: {} + assertAst('Multiple with empty', shell, 'b[[5,,]]', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + operator: '[[', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, + access: [{ + + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, null, null] + }) }, - access: [{ - type: RType.Argument, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } - }, null, null] - })) + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 3), + lexeme: '[[', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '[[', + content: '[[', + info: {}, + location: rangeFrom(1, 2, 1, 3), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'b', + content: 'b', + info: {} + }, { + type: RType.Argument, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + name: undefined, + info: {}, + value: { + type: RType.Number, + location: rangeFrom(1, 4, 1, 4), + lexeme: '5', + content: numVal(5), + info: {} + } + }, undefined, undefined] + }) + } + ]) }) describe('Dollar and Slot', () => { - assertAst('Dollar access', shell, 'c$x', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 2), - lexeme: '$', - operator: '$', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'c', - content: 'c', - info: {} + assertAst('Dollar access', shell, 'c$x', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 2), + lexeme: '$', + operator: '$', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'c', + content: 'c', + info: {} + }, + access: 'x' + }) }, - access: 'x' - })) - assertAst('Slot based access', shell, 'd@y', exprList({ - type: RType.Access, - location: rangeFrom(1, 2, 1, 2), - lexeme: '@', - operator: '@', - info: {}, - accessed: { - type: RType.Symbol, - location: rangeFrom(1, 1, 1, 1), - namespace: undefined, - lexeme: 'd', - content: 'd', - info: {} + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 2), + lexeme: '$', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '$', + content: '$', + info: {}, + location: rangeFrom(1, 2, 1, 2), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'c', + content: 'c', + info: {} + }, { + type: RType.Symbol, + location: rangeFrom(1, 3, 1, 3), + namespace: undefined, + lexeme: 'x', + content: 'x', + info: {} + }] + }) + } + ]) + assertAst('Slot based access', shell, 'd@y', [ + { + step: NORMALIZE, + wanted: exprList({ + type: RType.Access, + location: rangeFrom(1, 2, 1, 2), + lexeme: '@', + operator: '@', + info: {}, + accessed: { + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'd', + content: 'd', + info: {} + }, + access: 'y' + }) }, - access: 'y' - })) + { + step: DESUGAR_NORMALIZE, + wanted: exprList({ + type: RType.FunctionCall, + location: rangeFrom(1, 2, 1, 2), + lexeme: '@', + info: {}, + functionName: { + type: RType.Symbol, + lexeme: '@', + content: '@', + info: {}, + location: rangeFrom(1, 2, 1, 2), + namespace: undefined + }, + flavor: 'named', + arguments: [{ + type: RType.Symbol, + location: rangeFrom(1, 1, 1, 1), + namespace: undefined, + lexeme: 'd', + content: 'd', + info: {} + }, { + type: RType.Symbol, + location: rangeFrom(1, 3, 1, 3), + namespace: undefined, + lexeme: 'y', + content: 'y', + info: {} + }] + }) + } + ]) }) })) From 83d497f35f4c14dd5030e53245b34453dc2b0987 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 17 Jan 2024 11:04:57 +0100 Subject: [PATCH 12/12] test: internal scope and removed argument wraps --- .../r-bridge/lang/ast/parse-access.ts | 69 ++++++------------- 1 file changed, 20 insertions(+), 49 deletions(-) diff --git a/test/functionality/r-bridge/lang/ast/parse-access.ts b/test/functionality/r-bridge/lang/ast/parse-access.ts index 6a91846325..242e2d3475 100644 --- a/test/functionality/r-bridge/lang/ast/parse-access.ts +++ b/test/functionality/r-bridge/lang/ast/parse-access.ts @@ -412,7 +412,7 @@ describe('Parse value access', withShell(shell => { content: '[[', info: {}, location: rangeFrom(1, 2, 1, 3), - namespace: undefined + namespace: InternalScope }, location: rangeFrom(1, 2, 1, 3), flavor: 'named', @@ -473,7 +473,7 @@ describe('Parse value access', withShell(shell => { content: '[[', info: {}, location: rangeFrom(1, 2, 1, 3), - namespace: undefined + namespace: InternalScope }, flavor: 'named', arguments: [{ @@ -484,18 +484,11 @@ describe('Parse value access', withShell(shell => { content: 'b', info: {} }, { - type: RType.Argument, + type: RType.Number, location: rangeFrom(1, 4, 1, 4), lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } + content: numVal(5), + info: {} }] }) } @@ -559,7 +552,7 @@ describe('Parse value access', withShell(shell => { content: '[[', info: {}, location: rangeFrom(1, 2, 1, 3), - namespace: undefined + namespace: InternalScope }, flavor: 'named', arguments: [{ @@ -570,33 +563,18 @@ describe('Parse value access', withShell(shell => { content: 'b', info: {} }, { - type: RType.Argument, + type: RType.Number, location: rangeFrom(1, 4, 1, 4), lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } - }, { - type: RType.Argument, + content: numVal(5), + info: {} + }, { + type: RType.Number, location: rangeFrom(1, 6, 1, 6), lexeme: '3', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 6, 1, 6), - lexeme: '3', - content: numVal(3), - info: {} - } - } - ] + content: numVal(3), + info: {} + }] }) } ]) @@ -647,7 +625,7 @@ describe('Parse value access', withShell(shell => { content: '[[', info: {}, location: rangeFrom(1, 2, 1, 3), - namespace: undefined + namespace: InternalScope }, flavor: 'named', arguments: [{ @@ -658,18 +636,11 @@ describe('Parse value access', withShell(shell => { content: 'b', info: {} }, { - type: RType.Argument, + type: RType.Number, location: rangeFrom(1, 4, 1, 4), lexeme: '5', - name: undefined, - info: {}, - value: { - type: RType.Number, - location: rangeFrom(1, 4, 1, 4), - lexeme: '5', - content: numVal(5), - info: {} - } + content: numVal(5), + info: {} }, undefined, undefined] }) } @@ -709,7 +680,7 @@ describe('Parse value access', withShell(shell => { content: '$', info: {}, location: rangeFrom(1, 2, 1, 2), - namespace: undefined + namespace: InternalScope }, flavor: 'named', arguments: [{ @@ -763,7 +734,7 @@ describe('Parse value access', withShell(shell => { content: '@', info: {}, location: rangeFrom(1, 2, 1, 2), - namespace: undefined + namespace: InternalScope }, flavor: 'named', arguments: [{