From 587e60634315205caa5ea10221342299b09f185e Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Thu, 16 Jan 2025 10:12:41 -1000 Subject: [PATCH 1/9] First pass at adding block relative to the grammar --- src/utilities/codemirror/index.ts | 1 + src/utilities/codemirror/sequence.grammar | 6 ++-- src/utilities/sequence-editor/grammar.test.ts | 4 ++- .../sequence-editor/sequence-completion.ts | 7 ++++ .../sequence-editor/sequence-linter.ts | 34 ++++++++++++++----- src/utilities/sequence-editor/to-seq-json.ts | 16 ++++++++- 6 files changed, 55 insertions(+), 13 deletions(-) diff --git a/src/utilities/codemirror/index.ts b/src/utilities/codemirror/index.ts index ed501b9610..d0dee8e21f 100644 --- a/src/utilities/codemirror/index.ts +++ b/src/utilities/codemirror/index.ts @@ -49,6 +49,7 @@ export const SeqLanguage = LRLanguage.define({ Stem: t.keyword, String: t.string, TimeAbsolute: t.className, + TimeBlockRelative: t.className, TimeComplete: t.className, TimeEpoch: t.className, TimeGroundEpoch: t.className, diff --git a/src/utilities/codemirror/sequence.grammar b/src/utilities/codemirror/sequence.grammar index 8118fd5341..cd224a5000 100644 --- a/src/utilities/codemirror/sequence.grammar +++ b/src/utilities/codemirror/sequence.grammar @@ -70,7 +70,7 @@ HardwareCommands { commandBlock } -TimeTag { TimeAbsolute | (TimeGroundEpoch Name { String } whiteSpace) | TimeEpoch | TimeRelative | TimeComplete } +TimeTag { TimeAbsolute | (TimeGroundEpoch Name { String } whiteSpace) | TimeEpoch | TimeRelative | TimeComplete | TimeBlockRelative } Args { (whiteSpace (arg))* whiteSpace? @@ -178,6 +178,8 @@ Stem { !stemStart identifier } TimeRelative { 'R'(timeSecond | timeDOY | timeHhmmss) whiteSpace} + TimeBlockRelative { 'B'timeHhmmss whiteSpace } + TimeEpoch { 'E'$[+\-]?(timeSecond | timeDOY | timeHhmmss) whiteSpace} TimeGroundEpoch { 'G'$[+\-]?(timeSecond | timeDOY | timeHhmmss) whiteSpace} @@ -230,7 +232,7 @@ Stem { !stemStart identifier } @precedence { newLine, whiteSpace } - @precedence{ TimeAbsolute, TimeRelative, TimeEpoch, TimeComplete, TimeGroundEpoch, Boolean, identifier } + @precedence{ TimeAbsolute, TimeRelative, TimeEpoch, TimeComplete, TimeGroundEpoch, TimeBlockRelative, Boolean, identifier } @precedence { LoadAndGoDirective, diff --git a/src/utilities/sequence-editor/grammar.test.ts b/src/utilities/sequence-editor/grammar.test.ts index e4908dd272..ca8222fb91 100644 --- a/src/utilities/sequence-editor/grammar.test.ts +++ b/src/utilities/sequence-editor/grammar.test.ts @@ -348,6 +348,7 @@ A2024-123T12:34:56 @REQUEST_BEGIN("request2.name") R100 CMD_3 "1 2 3" C CMD_4 1 2 3 R100 CMD_5 "1 2 3" + B00:00:00 CMD_6 "1 2 3" @REQUEST_END @METADATA "foo" "bar" `, @@ -379,7 +380,8 @@ Sequence(Commands( Command(TimeTag(TimeComplete),Stem,Args(Number,Number,Number)), Command(TimeTag(TimeRelative),Stem,Args(String)), Command(TimeTag(TimeComplete),Stem,Args(Number,Number,Number)), - Command(TimeTag(TimeRelative),Stem,Args(String)) + Command(TimeTag(TimeRelative),Stem,Args(String)), + Command(TimeTag(TimeBlockRelative),Stem,Args(String)) ), Metadata(MetaEntry(Key(String),Value(String))) ) diff --git a/src/utilities/sequence-editor/sequence-completion.ts b/src/utilities/sequence-editor/sequence-completion.ts index aafeb2c767..8aad6c55b4 100644 --- a/src/utilities/sequence-editor/sequence-completion.ts +++ b/src/utilities/sequence-editor/sequence-completion.ts @@ -187,6 +187,13 @@ export function sequenceCompletion( section: 'Time Tags', type: 'keyword', }, + { + apply: 'B00:00:00 ', + info: 'Execute command at an offset from the block', + label: 'B (block relative)', + section: 'Time Tags', + type: 'keyword', + }, { apply: 'G1 "epoch.name" ', info: 'Add a ground epoch to a request', diff --git a/src/utilities/sequence-editor/sequence-linter.ts b/src/utilities/sequence-editor/sequence-linter.ts index 5c7ca1e3c1..720159e0ff 100644 --- a/src/utilities/sequence-editor/sequence-linter.ts +++ b/src/utilities/sequence-editor/sequence-linter.ts @@ -766,6 +766,7 @@ function validateTimeTags(command: SyntaxNode, text: string): Diagnostic[] { const timeTagAbsoluteNode = timeTagNode?.getChild('TimeAbsolute'); const timeTagEpochNode = timeTagNode?.getChild('TimeEpoch') ?? timeTagNode.getChild('TimeGroundEpoch'); const timeTagRelativeNode = timeTagNode?.getChild('TimeRelative'); + const timeTagBlockRelativeNode = timeTagNode?.getChild('TimeBlockRelative'); if (timeTagAbsoluteNode) { const absoluteText = text.slice(timeTagAbsoluteNode.from + 1, timeTagAbsoluteNode.to).trim(); @@ -834,36 +835,50 @@ function validateTimeTags(command: SyntaxNode, text: string): Diagnostic[] { } } } - } else if (timeTagRelativeNode) { - const relativeText = text.slice(timeTagRelativeNode.from + 1, timeTagRelativeNode.to).trim(); + } else if (timeTagRelativeNode || timeTagBlockRelativeNode) { + let relativeText = ''; + let from = -1; + let to = -1; + + if (timeTagRelativeNode) { + from = timeTagRelativeNode.from; + to = timeTagRelativeNode.to; + relativeText = text.slice(from + 1, to).trim(); + } else if (timeTagBlockRelativeNode) { + from = timeTagBlockRelativeNode.from; + to = timeTagBlockRelativeNode.to; + relativeText = text.slice(from + 1, to).trim(); + } + const isValid = - validateTime(relativeText, TimeTypes.RELATIVE) || validateTime(relativeText, TimeTypes.RELATIVE_SIMPLE); + validateTime(relativeText, TimeTypes.RELATIVE) || + (validateTime(relativeText, TimeTypes.RELATIVE_SIMPLE) && !timeTagBlockRelativeNode); if (!isValid) { diagnostics.push({ actions: [], - from: timeTagRelativeNode.from, + from, message: CustomErrorCodes.InvalidRelativeTime().message, severity: 'error', - to: timeTagRelativeNode.to, + to, }); } else { if (validateTime(relativeText, TimeTypes.RELATIVE)) { if (isTimeMax(relativeText, TimeTypes.RELATIVE)) { diagnostics.push({ actions: [], - from: timeTagRelativeNode.from, + from, message: CustomErrorCodes.MaxRelativeTime().message, severity: 'error', - to: timeTagRelativeNode.to, + to, }); } else { if (!isTimeBalanced(relativeText, TimeTypes.EPOCH)) { diagnostics.push({ actions: [], - from: timeTagRelativeNode.from, + from, message: CustomErrorCodes.UnbalancedTime(getBalancedDuration(relativeText)).message, severity: 'error', - to: timeTagRelativeNode.to, + to, }); } } @@ -871,6 +886,7 @@ function validateTimeTags(command: SyntaxNode, text: string): Diagnostic[] { } } } + return diagnostics; } diff --git a/src/utilities/sequence-editor/to-seq-json.ts b/src/utilities/sequence-editor/to-seq-json.ts index d4b17e42f4..3c3fc64b11 100644 --- a/src/utilities/sequence-editor/to-seq-json.ts +++ b/src/utilities/sequence-editor/to-seq-json.ts @@ -428,12 +428,13 @@ function parseTime(commandNode: SyntaxNode, text: string): Time { const timeTagCompleteNode = timeTagNode.getChild('TimeComplete'); const timeTagEpochNode = timeTagNode.getChild('TimeEpoch') || timeTagNode.getChild('TimeGroundEpoch'); const timeTagRelativeNode = timeTagNode.getChild('TimeRelative'); + const timeTagBlockRelativeNode = timeTagNode.getChild('TimeBlockRelative'); if (timeTagCompleteNode) { return { type: 'COMMAND_COMPLETE' }; } - if (!timeTagAbsoluteNode && !timeTagEpochNode && !timeTagRelativeNode) { + if (!timeTagAbsoluteNode && !timeTagEpochNode && !timeTagRelativeNode && !timeTagBlockRelativeNode) { return { tag, type: 'ABSOLUTE' }; } @@ -479,7 +480,20 @@ function parseTime(commandNode: SyntaxNode, text: string): Time { } return { tag, type: 'COMMAND_RELATIVE' }; } + } else if (timeTagBlockRelativeNode) { + const timeTagBlockRelativeText = text.slice(timeTagBlockRelativeNode.from + 1, timeTagBlockRelativeNode.to).trim(); + + if (validateTime(timeTagBlockRelativeText, TimeTypes.RELATIVE)) { + const { isNegative, days, hours, minutes, seconds, milliseconds } = getDurationTimeComponents( + parseDurationString(timeTagBlockRelativeText, 'seconds'), + ); + tag = `${isNegative}${days}${days ? 'T' : ''}${hours}:${minutes}:${seconds}${milliseconds ? '.' : ''}${milliseconds}`; + + // TODO: Update seqjson lib to include block_relative + return { tag, type: 'COMMAND_BLOCK_RELATIVE' }; + } } + return { tag, type: 'ABSOLUTE' }; } From 44d50111429b61f969cf437698c523539e62dfd9 Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 21 Jan 2025 12:25:11 -1000 Subject: [PATCH 2/9] Finished adding notes --- package-lock.json | 8 ++++---- package.json | 2 +- src/utilities/codemirror/index.ts | 1 + src/utilities/codemirror/sequence.grammar | 15 +++++++++++++-- src/utilities/sequence-editor/grammar.test.ts | 2 ++ .../sequence-editor/sequence-completion.ts | 15 +++++++++++++++ src/utilities/sequence-editor/to-seq-json.ts | 3 +-- 7 files changed, 37 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 43d61f3d1a..a1d5a0c434 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@fontsource/jetbrains-mono": "^5.0.19", "@nasa-jpl/aerie-ampcs": "^1.0.5", - "@nasa-jpl/seq-json-schema": "^1.2.0", + "@nasa-jpl/seq-json-schema": "^1.3.0", "@nasa-jpl/stellar": "^1.1.18", "@streamparser/json": "^0.0.17", "@sveltejs/adapter-node": "5.0.1", @@ -1126,9 +1126,9 @@ } }, "node_modules/@nasa-jpl/seq-json-schema": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@nasa-jpl/seq-json-schema/-/seq-json-schema-1.2.0.tgz", - "integrity": "sha512-C1t2i7EJM1dyxLCMeDcwff+0jbW98mFo3mfC3YUhDvAc15HjQG2bJf1fVCsPZMuqsHxEHVi5WmvFScTUqgcJmQ==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@nasa-jpl/seq-json-schema/-/seq-json-schema-1.3.0.tgz", + "integrity": "sha512-faLcXdeGNFNtc5EB6PZ55mpmL5DQ4guCkZpeoeLbpEwNqo7envyPRsJZNZPPxfvNaCdIkpZvOJlC0mBsFVjcIg==" }, "node_modules/@nasa-jpl/stellar": { "version": "1.1.18", diff --git a/package.json b/package.json index 4f4c68f82e..d1e2ae9d3a 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "dependencies": { "@fontsource/jetbrains-mono": "^5.0.19", "@nasa-jpl/aerie-ampcs": "^1.0.5", - "@nasa-jpl/seq-json-schema": "^1.2.0", + "@nasa-jpl/seq-json-schema": "^1.3.0", "@nasa-jpl/stellar": "^1.1.18", "@streamparser/json": "^0.0.17", "@sveltejs/adapter-node": "5.0.1", diff --git a/src/utilities/codemirror/index.ts b/src/utilities/codemirror/index.ts index d0dee8e21f..6dd65acc59 100644 --- a/src/utilities/codemirror/index.ts +++ b/src/utilities/codemirror/index.ts @@ -44,6 +44,7 @@ export const SeqLanguage = LRLanguage.define({ LocalDeclaration: t.namespace, MetaEntry: t.namespace, Model: t.namespace, + Note: t.namespace, ParameterDeclaration: t.namespace, Request: t.namespace, Stem: t.keyword, diff --git a/src/utilities/codemirror/sequence.grammar b/src/utilities/codemirror/sequence.grammar index cd224a5000..3772e20925 100644 --- a/src/utilities/codemirror/sequence.grammar +++ b/src/utilities/codemirror/sequence.grammar @@ -45,7 +45,7 @@ commandBlock { )+ } -step { Command | Activate | GroundBlock | GroundEvent | Load } +step { Command | Activate | GroundBlock | GroundEvent | Load | Note } commentLine { LineComment newLine @@ -120,6 +120,15 @@ commonGround { Models? } +Note { + TimeTag + noteDirective "(" NoteValue { String } ")" + Args + LineComment? + newLine + Metadata? +} + Request { TimeTag requestStartDirective "(" RequestName { String } ")" @@ -178,7 +187,7 @@ Stem { !stemStart identifier } TimeRelative { 'R'(timeSecond | timeDOY | timeHhmmss) whiteSpace} - TimeBlockRelative { 'B'timeHhmmss whiteSpace } + TimeBlockRelative { 'B'$[+\-]?(timeSecond | timeDOY | timeHhmmss) whiteSpace } TimeEpoch { 'E'$[+\-]?(timeSecond | timeDOY | timeHhmmss) whiteSpace} @@ -228,6 +237,7 @@ Stem { !stemStart identifier } requestEndDirective { "@REQUEST_END" } metadataDirective { "@METADATA" } modelDirective { "@MODEL" } + noteDirective { "@NOTE" } genericDirective { "@"identifier } @precedence { newLine, whiteSpace } @@ -251,6 +261,7 @@ Stem { !stemStart identifier } loadDirective, groundBlockDirective, groundEventDirective, + noteDirective, requestStartDirective, requestEndDirective, engineDirective, diff --git a/src/utilities/sequence-editor/grammar.test.ts b/src/utilities/sequence-editor/grammar.test.ts index ca8222fb91..b6d75abf7d 100644 --- a/src/utilities/sequence-editor/grammar.test.ts +++ b/src/utilities/sequence-editor/grammar.test.ts @@ -317,6 +317,7 @@ Command(Stem,Args(String),Models(Model(Variable(String),Value(String),Offset(Str [ `Seq.Json comprehension`, `A2024-123T12:34:56 @GROUND_BLOCK("ground_block.name") # No Args +C @NOTE("note_value") R123T12:34:56 @GROUND_EVENT("ground_event.name") "foo" 1 2 3 A2024-123T12:34:56 @ACTIVATE("activate.name") # No Args @ENGINE 10 @@ -355,6 +356,7 @@ A2024-123T12:34:56 @REQUEST_BEGIN("request2.name") ` Sequence(Commands( GroundBlock(TimeTag(TimeAbsolute),GroundName(String),Args,LineComment), + Note(TimeTag(TimeComplete),NoteValue(String)Args), GroundEvent(TimeTag(TimeRelative),GroundName(String),Args(String,Number,Number,Number)), Activate(TimeTag(TimeAbsolute),SequenceName(String),Args,LineComment,Engine(Number),Epoch(String)), Activate(TimeTag(TimeRelative),SequenceName(String),Args(String,Number,Number,Number),LineComment,Engine(Number)), diff --git a/src/utilities/sequence-editor/sequence-completion.ts b/src/utilities/sequence-editor/sequence-completion.ts index 8aad6c55b4..d2c128c8b4 100644 --- a/src/utilities/sequence-editor/sequence-completion.ts +++ b/src/utilities/sequence-editor/sequence-completion.ts @@ -223,6 +223,21 @@ export function sequenceCompletion( section: 'Directives', type: 'keyword', }, + { + apply: (view, _completion, from: number, to: number) => { + view.dispatch({ + changes: { + from: Math.max(0, from + (!cursor.isAfterTimeTag || cursor.isAtSymbolBefore ? -1 : 0)), + insert: `${!cursor.isAfterTimeTag ? 'C ' : ''}@NOTE("note_value")`, + to, + }, + }); + }, + info: 'note', + label: '@NOTE', + section: 'Directives', + type: 'function', + }, ); } diff --git a/src/utilities/sequence-editor/to-seq-json.ts b/src/utilities/sequence-editor/to-seq-json.ts index 3c3fc64b11..4b7a85f514 100644 --- a/src/utilities/sequence-editor/to-seq-json.ts +++ b/src/utilities/sequence-editor/to-seq-json.ts @@ -489,8 +489,7 @@ function parseTime(commandNode: SyntaxNode, text: string): Time { ); tag = `${isNegative}${days}${days ? 'T' : ''}${hours}:${minutes}:${seconds}${milliseconds ? '.' : ''}${milliseconds}`; - // TODO: Update seqjson lib to include block_relative - return { tag, type: 'COMMAND_BLOCK_RELATIVE' }; + return { tag, type: 'BLOCK_RELATIVE' }; } } From 38a11da4f580e6024f9195d3e91c5ffbb2dcfac9 Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 21 Jan 2025 12:47:39 -1000 Subject: [PATCH 3/9] Added note seqjson converter --- src/utilities/sequence-editor/to-seq-json.ts | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/utilities/sequence-editor/to-seq-json.ts b/src/utilities/sequence-editor/to-seq-json.ts index 4b7a85f514..eccc48d908 100644 --- a/src/utilities/sequence-editor/to-seq-json.ts +++ b/src/utilities/sequence-editor/to-seq-json.ts @@ -16,6 +16,7 @@ import type { Load, Metadata, Model, + Note, NumberArgument, RepeatArgument, Request, @@ -144,6 +145,26 @@ function parseRequest(requestNode: SyntaxNode, text: string, commandDictionary: }; } +function parseNote(stepNode: SyntaxNode, text: string): Note { + const time = parseTime(stepNode, text); + + const noteValueNode = stepNode.getChild('NoteValue'); + const noteValue = noteValueNode ? unquoteUnescape(text.slice(noteValueNode.from, noteValueNode.to)) : 'UNKNOWN'; + + const description = parseDescription(stepNode, text); + const metadata = parseMetadata(stepNode, text); + const models = parseModel(stepNode, text); + + return { + description, + metadata, + models, + string_arg: noteValue, + time, + type: 'note', + }; +} + function parseGroundBlockEvent(stepNode: SyntaxNode, text: string): GroundBlock | GroundEvent { const time = parseTime(stepNode, text); @@ -263,6 +284,8 @@ function parseStep(child: SyntaxNode, text: string, commandDictionary: CommandDi case 'GroundBlock': case 'GroundEvent': return parseGroundBlockEvent(child, text); + case 'Note': + return parseNote(child, text); } // Standalone comment nodes (not descriptions of steps), are not supported in the seq.json schema // Until a schema change is coordinated, comments will dropped while writing out seq.json. From ddc3afad23d5ce6729eed7c9f3bfbe07e1d32d96 Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 21 Jan 2025 13:19:58 -1000 Subject: [PATCH 4/9] Added Time1 as a param to the seqjson time conversion function --- src/utilities/sequence-editor/from-seq-json.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utilities/sequence-editor/from-seq-json.ts b/src/utilities/sequence-editor/from-seq-json.ts index aa0540cff8..c846899b27 100644 --- a/src/utilities/sequence-editor/from-seq-json.ts +++ b/src/utilities/sequence-editor/from-seq-json.ts @@ -18,6 +18,7 @@ import type { StringArgument, SymbolArgument, Time, + Time1, VariableDeclaration, } from '@nasa-jpl/seq-json-schema/types'; import { quoteEscape } from '../codemirror/codemirror-utils'; @@ -26,7 +27,7 @@ import { logError } from './logger'; /** * Transform a sequence JSON time to it's sequence string form. */ -function seqJsonTimeToSequence(time: Time): string { +function seqJsonTimeToSequence(time: Time | Time1): string { switch (time.type) { case 'ABSOLUTE': return `A${time.tag ?? ''}`; From 9adef8ea760e7aa552de0b886a6547d66eda7aee Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 28 Jan 2025 11:51:25 -1000 Subject: [PATCH 5/9] Added more missing block relative logic --- src/utilities/codemirror/satf/satf-sasf-utils.ts | 3 +-- src/utilities/sequence-editor/from-seq-json.ts | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utilities/codemirror/satf/satf-sasf-utils.ts b/src/utilities/codemirror/satf/satf-sasf-utils.ts index 9b1bb51b9d..523c762b36 100644 --- a/src/utilities/codemirror/satf/satf-sasf-utils.ts +++ b/src/utilities/codemirror/satf/satf-sasf-utils.ts @@ -816,8 +816,7 @@ function parseTimeNode(timeNode: SyntaxNode | null, text: string): string { return `R${time} `; case 'FROM_REQUEST_START': case 'FROM_ACTIVITY_START': - // TODO: This needs to be changed to refer to the start of the request. - return `R${time} `; + return `B${time} `; case 'WAIT_PREVIOUS_END': return `C `; default: diff --git a/src/utilities/sequence-editor/from-seq-json.ts b/src/utilities/sequence-editor/from-seq-json.ts index c846899b27..89dc36e7b3 100644 --- a/src/utilities/sequence-editor/from-seq-json.ts +++ b/src/utilities/sequence-editor/from-seq-json.ts @@ -37,6 +37,8 @@ function seqJsonTimeToSequence(time: Time | Time1): string { return `R${time.tag ?? ''}`; case 'EPOCH_RELATIVE': return `E${time.tag ?? ''}`; + case 'BLOCK_RELATIVE': + return `B${time.tag ?? ''}`; default: return ''; } From bd15f2ae233920264d93f37d33b00db4d189f851 Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Wed, 29 Jan 2025 08:51:26 -1000 Subject: [PATCH 6/9] Added a new timeSegments token for our seqn grammar --- src/utilities/codemirror/sequence.grammar | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utilities/codemirror/sequence.grammar b/src/utilities/codemirror/sequence.grammar index 3772e20925..273f1f60a0 100644 --- a/src/utilities/codemirror/sequence.grammar +++ b/src/utilities/codemirror/sequence.grammar @@ -183,15 +183,17 @@ Stem { !stemStart identifier } timeSecond { $[1-9] @digit* ("."@digit+)? } + timeSegments { timeSecond | timeDOY | timeHhmmss } + TimeAbsolute { 'A'@digit@digit@digit@digit"-"@digit@digit@digit"T"timeHhmmss whiteSpace } - TimeRelative { 'R'(timeSecond | timeDOY | timeHhmmss) whiteSpace} + TimeRelative { 'R'timeSegments whiteSpace} - TimeBlockRelative { 'B'$[+\-]?(timeSecond | timeDOY | timeHhmmss) whiteSpace } + TimeBlockRelative { 'B'$[+\-]?timeSegments whiteSpace } - TimeEpoch { 'E'$[+\-]?(timeSecond | timeDOY | timeHhmmss) whiteSpace} + TimeEpoch { 'E'$[+\-]?timeSegments whiteSpace} - TimeGroundEpoch { 'G'$[+\-]?(timeSecond | timeDOY | timeHhmmss) whiteSpace} + TimeGroundEpoch { 'G'$[+\-]?timeSegments whiteSpace} TimeComplete { 'C' whiteSpace } From 28816c009c463061a2565e0c072bb22f9835faaa Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Thu, 30 Jan 2025 08:20:01 -1000 Subject: [PATCH 7/9] Fixed some broken sasf tests that were using R rather than the new B time tag --- src/utilities/codemirror/satf/satf-sasf-utils.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utilities/codemirror/satf/satf-sasf-utils.test.ts b/src/utilities/codemirror/satf/satf-sasf-utils.test.ts index 02da771e8d..b1ca4df96e 100644 --- a/src/utilities/codemirror/satf/satf-sasf-utils.test.ts +++ b/src/utilities/codemirror/satf/satf-sasf-utils.test.ts @@ -90,7 +90,7 @@ describe('satfToSequence', () => { expect(result).toHaveProperty('sequences'); expect(result.sequences[0].name).toStrictEqual('test'); expect(result.sequences[0].sequence).toStrictEqual(`## test -R00:01:00 01VV param6 10 false "abc" # This command turns, to correct position. +B00:01:00 01VV param6 10 false "abc" # This command turns, to correct position. @MODEL "x" 1 "00:00:00" @MODEL "z" 1.1 "00:00:00" @MODEL "y" "abc" "00:00:00"`); @@ -126,7 +126,7 @@ R00:01:00 01VV param6 10 false "abc" # This command turns, to correct position. expect(result.sequences.length).toBe(2); expect(result.sequences[0].name).toStrictEqual('test'); expect(result.sequences[0].sequence).toStrictEqual(`## test -R00:01:00 01VV param6 10 false "abc" # This command turns, to correct position. +B00:01:00 01VV param6 10 false "abc" # This command turns, to correct position. @MODEL "x" 1 "00:00:00" @MODEL "z" 1.1 "00:00:00" @MODEL "y" "abc" "00:00:00"`); @@ -288,7 +288,7 @@ string STRING quoted_string STRING "" "abc, 123" @INPUT_PARAMS_END -R00:01:00 NOOP`); +B00:01:00 NOOP`); }); it('Quoted Parameters', async () => { @@ -318,6 +318,6 @@ R00:01:00 NOOP`); attitude_spec ENUM STORE_NAME "" "BOB_HARDWARE, SALLY_FARM, TIM_FLOWERS" @INPUT_PARAMS_END -R00:01:00 ECHO "abc"`); +B00:01:00 ECHO "abc"`); }); }); From 0775010f560f55c28dd508802d346c4aab63d3f1 Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 11 Feb 2025 07:19:06 -1000 Subject: [PATCH 8/9] Removed Time1 from from-seq-json --- package-lock.json | 8 ++++---- package.json | 2 +- src/utilities/sequence-editor/from-seq-json.ts | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index a1d5a0c434..1858af77f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@fontsource/jetbrains-mono": "^5.0.19", "@nasa-jpl/aerie-ampcs": "^1.0.5", - "@nasa-jpl/seq-json-schema": "^1.3.0", + "@nasa-jpl/seq-json-schema": "^1.3.1", "@nasa-jpl/stellar": "^1.1.18", "@streamparser/json": "^0.0.17", "@sveltejs/adapter-node": "5.0.1", @@ -1126,9 +1126,9 @@ } }, "node_modules/@nasa-jpl/seq-json-schema": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@nasa-jpl/seq-json-schema/-/seq-json-schema-1.3.0.tgz", - "integrity": "sha512-faLcXdeGNFNtc5EB6PZ55mpmL5DQ4guCkZpeoeLbpEwNqo7envyPRsJZNZPPxfvNaCdIkpZvOJlC0mBsFVjcIg==" + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@nasa-jpl/seq-json-schema/-/seq-json-schema-1.3.1.tgz", + "integrity": "sha512-0WC75kGX9RCsYi6Ajpf9CgxR5wadR81GntznWZgWZQedbgRjORueaVmxVagLZFaR2a2L3ShIPJs2TjlRZH2PhA==" }, "node_modules/@nasa-jpl/stellar": { "version": "1.1.18", diff --git a/package.json b/package.json index d1e2ae9d3a..a7cd1234bc 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "dependencies": { "@fontsource/jetbrains-mono": "^5.0.19", "@nasa-jpl/aerie-ampcs": "^1.0.5", - "@nasa-jpl/seq-json-schema": "^1.3.0", + "@nasa-jpl/seq-json-schema": "^1.3.1", "@nasa-jpl/stellar": "^1.1.18", "@streamparser/json": "^0.0.17", "@sveltejs/adapter-node": "5.0.1", diff --git a/src/utilities/sequence-editor/from-seq-json.ts b/src/utilities/sequence-editor/from-seq-json.ts index 89dc36e7b3..94e6bc7a29 100644 --- a/src/utilities/sequence-editor/from-seq-json.ts +++ b/src/utilities/sequence-editor/from-seq-json.ts @@ -18,7 +18,6 @@ import type { StringArgument, SymbolArgument, Time, - Time1, VariableDeclaration, } from '@nasa-jpl/seq-json-schema/types'; import { quoteEscape } from '../codemirror/codemirror-utils'; @@ -27,7 +26,7 @@ import { logError } from './logger'; /** * Transform a sequence JSON time to it's sequence string form. */ -function seqJsonTimeToSequence(time: Time | Time1): string { +function seqJsonTimeToSequence(time: Time): string { switch (time.type) { case 'ABSOLUTE': return `A${time.tag ?? ''}`; From 50613aa845754a7995e48e7745b7602fe5ccc295 Mon Sep 17 00:00:00 2001 From: Cody Hansen Date: Tue, 11 Feb 2025 07:30:42 -1000 Subject: [PATCH 9/9] Fixed an issue now that there's a distinct time type without a tag --- src/utilities/sequence-editor/to-seq-json.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/utilities/sequence-editor/to-seq-json.ts b/src/utilities/sequence-editor/to-seq-json.ts index eccc48d908..1481fde702 100644 --- a/src/utilities/sequence-editor/to-seq-json.ts +++ b/src/utilities/sequence-editor/to-seq-json.ts @@ -428,9 +428,20 @@ function parseGroundEpoch(groundEpochNode: SyntaxNode | null, text: string): Gro if (!groundEpochNode) { return { delta: '', name: '' }; } + const nameNode = groundEpochNode.getChild('Name'); + let tag = ''; + + if (groundEpochNode.parent) { + const time = parseTime(groundEpochNode.parent, text); + + if (time.type !== 'COMMAND_COMPLETE') { + tag = time.tag; + } + } + return { - delta: groundEpochNode.parent ? parseTime(groundEpochNode.parent, text).tag : '', + delta: tag, name: nameNode ? unquoteUnescape(text.slice(nameNode.from, nameNode.to)) : '', }; }