Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SATF/SASF Grammar support #1574

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

SATF/SASF Grammar support #1574

wants to merge 3 commits into from

Conversation

goetzrrGit
Copy link
Contributor

Closes #1496
I added support for SATF and SASF formats, which includes:

  • 85% of the grammar rules in SATF are now supported
  • I've also added support for 60% of the grammar rules in SASF, using references from Phyche SASF and NISAR

I created a converter which will eventually be a npm plugin that can take SeqN data and generate most of the SATF/SASF content. This is because each mission has slight variation so they can use this to generate 90% of the SATF/SASF and fill in the mission specific parts in their adaptation.

There's also a way to convert a SATF/SASF file into SeqN format. Not everything is carried over as SeqN doesn't support all the features of SATF/SASF

TESTING
You can find a bunch of SATF/SASF here: https://jpl365prod-my.sharepoint.com/:f:/g/personal/shaheer_khan_jpl_nasa_gov/EplqvV9nI9ZJo6JT1KVzoVwBKZHzFNbVGXWi2qUaN6k1yg?e=zIbLEa

This is hard to test as it requires hacking the Sequence Editor to use the top editor as a SATF/SASF editor and the bottom editor as a SeqN. Here is the modification I did.

  // Reconfigure sequence editor.
          editorSequenceView.dispatch({
            effects: [
              compartmentSeqLanguage.reconfigure(
                setupLanguageSupport(
                  $sequenceAdaptation.autoComplete(
                    parsedChannelDictionary,
                    parsedCommandDictionary,
                    nonNullParsedParameterDictionaries,
                    librarySequences,
                  ),
                ),
              ),
              compartmentSeqLanguage.reconfigure(setupSatfLanguageSupport()), <---- Add this line
              compartmentSeqLinter.reconfigure(
                inputLinter(
                  parsedChannelDictionary,
                  parsedCommandDictionary,
                  nonNullParsedParameterDictionaries,
                  librarySequences,
                ),
              ),
              compartmentSeqTooltip.reconfigure(
                sequenceTooltip(parsedChannelDictionary, parsedCommandDictionary, nonNullParsedParameterDictionaries),
              ),
              ...($sequenceAdaptation.autoIndent
                ? [compartmentSeqAutocomplete.reconfigure(indentService.of($sequenceAdaptation.autoIndent()))]
                : []),
            ],
          });

    if ($sequenceAdaptation?.modifyOutput !== undefined && output !== undefined) {
      const modifiedOutput = $sequenceAdaptation.modifyOutput(output, parameterDictionaries, channelDictionary);
      if (modifiedOutput === null) {
        output = 'modifyOutput returned null. Verify your adaptation is correct';
      } else if (modifiedOutput === undefined) {
        output = 'modifyOutput returned undefined. Verify your adaptation is correct';
      } else if (typeof modifiedOutput === 'object') {
        output = JSON.stringify(modifiedOutput);
      } else {
        output = `${modifiedOutput}`;
      }
    }
    
    const seqN = await satfToSequence(sequence);  <--------- Add this line
    output = seqN.header + '\n' + seqN.sequences.join('\n'); <----- Add this line

    editorOutputView.dispatch({ changes: { from: 0, insert: output, to: editorOutputView.state.doc.length } });

    if (output !== undefined) {
      dispatch('sequence', { input: sequence, output });
    }

@goetzrrGit goetzrrGit requested a review from a team as a code owner December 10, 2024 16:37
@goetzrrGit goetzrrGit self-assigned this Dec 10, 2024
@goetzrrGit goetzrrGit requested a review from cohansen December 10, 2024 16:37
* Converts parts of SeqN to SATF/SASF
* Converts parts SATF/SASF to SeqN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify Psyche and Nisar SASF and SATF support
1 participant