diff --git a/docs/html/BidsFile.html b/docs/html/BidsFile.html index b9a5ce8a..05e307ad 100644 --- a/docs/html/BidsFile.html +++ b/docs/html/BidsFile.html @@ -367,7 +367,7 @@

Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsHedIssue_BidsHedIssue.html b/docs/html/BidsHedIssue_BidsHedIssue.html index cf56f4fc..8476bb9a 100644 --- a/docs/html/BidsHedIssue_BidsHedIssue.html +++ b/docs/html/BidsHedIssue_BidsHedIssue.html @@ -189,7 +189,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsHedSidecarValidator.html b/docs/html/BidsHedSidecarValidator.html index 188994ea..a2b376f5 100644 --- a/docs/html/BidsHedSidecarValidator.html +++ b/docs/html/BidsHedSidecarValidator.html @@ -298,7 +298,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsHedTsvParser.html b/docs/html/BidsHedTsvParser.html index 7c1751f4..b0c80498 100644 --- a/docs/html/BidsHedTsvParser.html +++ b/docs/html/BidsHedTsvParser.html @@ -392,7 +392,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsHedTsvValidator.html b/docs/html/BidsHedTsvValidator.html index 2f2210e9..3f1a0dfd 100644 --- a/docs/html/BidsHedTsvValidator.html +++ b/docs/html/BidsHedTsvValidator.html @@ -378,7 +378,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsHedValidator.html b/docs/html/BidsHedValidator.html index 3073ef63..3843cf59 100644 --- a/docs/html/BidsHedValidator.html +++ b/docs/html/BidsHedValidator.html @@ -337,7 +337,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsJsonFile.html b/docs/html/BidsJsonFile.html index 213db186..09315d50 100644 --- a/docs/html/BidsJsonFile.html +++ b/docs/html/BidsJsonFile.html @@ -189,7 +189,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsSidecarKey_BidsSidecarKey.html b/docs/html/BidsSidecarKey_BidsSidecarKey.html index 0f0d0912..b6fe49eb 100644 --- a/docs/html/BidsSidecarKey_BidsSidecarKey.html +++ b/docs/html/BidsSidecarKey_BidsSidecarKey.html @@ -202,7 +202,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsSidecar_BidsSidecar.html b/docs/html/BidsSidecar_BidsSidecar.html index e8fbd0f7..5f09f1b1 100644 --- a/docs/html/BidsSidecar_BidsSidecar.html +++ b/docs/html/BidsSidecar_BidsSidecar.html @@ -220,7 +220,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsTsvElement_BidsTsvElement.html b/docs/html/BidsTsvElement_BidsTsvElement.html index 51c2e1b0..7a1ef6f8 100644 --- a/docs/html/BidsTsvElement_BidsTsvElement.html +++ b/docs/html/BidsTsvElement_BidsTsvElement.html @@ -212,7 +212,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsTsvFile.html b/docs/html/BidsTsvFile.html index 66f2cb4d..76f12060 100644 --- a/docs/html/BidsTsvFile.html +++ b/docs/html/BidsTsvFile.html @@ -409,7 +409,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsTsvRow.html b/docs/html/BidsTsvRow.html index 9d44c556..7d428280 100644 --- a/docs/html/BidsTsvRow.html +++ b/docs/html/BidsTsvRow.html @@ -248,7 +248,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/BidsValidator.html b/docs/html/BidsValidator.html index 38653a72..11fe00ab 100644 --- a/docs/html/BidsValidator.html +++ b/docs/html/BidsValidator.html @@ -317,7 +317,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/ColumnSpliceSpec.html b/docs/html/ColumnSpliceSpec.html index a8d061df..643822e8 100644 --- a/docs/html/ColumnSpliceSpec.html +++ b/docs/html/ColumnSpliceSpec.html @@ -189,7 +189,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/DefinitionChecker_DefinitionChecker.html b/docs/html/DefinitionChecker_DefinitionChecker.html index e05e333f..1bc967de 100644 --- a/docs/html/DefinitionChecker_DefinitionChecker.html +++ b/docs/html/DefinitionChecker_DefinitionChecker.html @@ -181,7 +181,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/Definition_Definition.html b/docs/html/Definition_Definition.html index 68df06e3..6e6b3bba 100644 --- a/docs/html/Definition_Definition.html +++ b/docs/html/Definition_Definition.html @@ -179,7 +179,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/GroupSpec.html b/docs/html/GroupSpec.html index ee73b60c..6507341b 100644 --- a/docs/html/GroupSpec.html +++ b/docs/html/GroupSpec.html @@ -190,7 +190,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/HedStringParser.html b/docs/html/HedStringParser.html index e1d595cb..60f6e53c 100644 --- a/docs/html/HedStringParser.html +++ b/docs/html/HedStringParser.html @@ -224,7 +224,7 @@
    Type:

    Methods

    - parseHedString()parse() → {Array}

    @@ -452,7 +452,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/HedStringTokenizer.html b/docs/html/HedStringTokenizer.html index ee293646..9a419916 100644 --- a/docs/html/HedStringTokenizer.html +++ b/docs/html/HedStringTokenizer.html @@ -196,7 +196,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/Issue.html b/docs/html/Issue.html index d8f9ebba..ed07413d 100644 --- a/docs/html/Issue.html +++ b/docs/html/Issue.html @@ -488,7 +488,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/ParsedHedColumnSplice.html b/docs/html/ParsedHedColumnSplice.html index c1551657..820f438e 100644 --- a/docs/html/ParsedHedColumnSplice.html +++ b/docs/html/ParsedHedColumnSplice.html @@ -265,7 +265,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/ParsedHedString.html b/docs/html/ParsedHedString.html index 939069bd..5f0f5b38 100644 --- a/docs/html/ParsedHedString.html +++ b/docs/html/ParsedHedString.html @@ -529,7 +529,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/ParsedHedSubstring.html b/docs/html/ParsedHedSubstring.html index 2e326fd8..5df344cc 100644 --- a/docs/html/ParsedHedSubstring.html +++ b/docs/html/ParsedHedSubstring.html @@ -364,7 +364,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/PartneredSchema.html b/docs/html/PartneredSchema.html index a3eed84f..94036865 100644 --- a/docs/html/PartneredSchema.html +++ b/docs/html/PartneredSchema.html @@ -219,7 +219,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/Schema.html b/docs/html/Schema.html index ac4a7a27..1a2dd44f 100644 --- a/docs/html/Schema.html +++ b/docs/html/Schema.html @@ -422,7 +422,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaAttribute.html b/docs/html/SchemaAttribute.html index c5d59943..1694f4ab 100644 --- a/docs/html/SchemaAttribute.html +++ b/docs/html/SchemaAttribute.html @@ -337,7 +337,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaEntries.html b/docs/html/SchemaEntries.html index e08cb373..9ebec11f 100644 --- a/docs/html/SchemaEntries.html +++ b/docs/html/SchemaEntries.html @@ -506,7 +506,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaEntry.html b/docs/html/SchemaEntry.html index 0209cd5d..58c98cc9 100644 --- a/docs/html/SchemaEntry.html +++ b/docs/html/SchemaEntry.html @@ -265,7 +265,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaEntryManager.html b/docs/html/SchemaEntryManager.html index 955e4128..b0d74d4a 100644 --- a/docs/html/SchemaEntryManager.html +++ b/docs/html/SchemaEntryManager.html @@ -589,7 +589,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaEntryWithAttributes.html b/docs/html/SchemaEntryWithAttributes.html index 7d2a25c0..13ce59bd 100644 --- a/docs/html/SchemaEntryWithAttributes.html +++ b/docs/html/SchemaEntryWithAttributes.html @@ -526,7 +526,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaProperty.html b/docs/html/SchemaProperty.html index 7115189e..a3aad0c0 100644 --- a/docs/html/SchemaProperty.html +++ b/docs/html/SchemaProperty.html @@ -243,7 +243,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaSpec.html b/docs/html/SchemaSpec.html index 85169571..da2f70de 100644 --- a/docs/html/SchemaSpec.html +++ b/docs/html/SchemaSpec.html @@ -351,7 +351,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaTag.html b/docs/html/SchemaTag.html index 5f0a9265..3435cbf6 100644 --- a/docs/html/SchemaTag.html +++ b/docs/html/SchemaTag.html @@ -554,7 +554,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaTagManager.html b/docs/html/SchemaTagManager.html index 4e948b3d..2c9eeaab 100644 --- a/docs/html/SchemaTagManager.html +++ b/docs/html/SchemaTagManager.html @@ -408,7 +408,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaUnit.html b/docs/html/SchemaUnit.html index bd9048a0..a6cd310b 100644 --- a/docs/html/SchemaUnit.html +++ b/docs/html/SchemaUnit.html @@ -312,7 +312,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaUnitClass.html b/docs/html/SchemaUnitClass.html index fe42559a..f3ecd955 100644 --- a/docs/html/SchemaUnitClass.html +++ b/docs/html/SchemaUnitClass.html @@ -318,7 +318,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaUnitModifier.html b/docs/html/SchemaUnitModifier.html index a743b8fb..2eb49f2f 100644 --- a/docs/html/SchemaUnitModifier.html +++ b/docs/html/SchemaUnitModifier.html @@ -162,7 +162,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaValueClass.html b/docs/html/SchemaValueClass.html index 0b7c7c31..3dcba92f 100644 --- a/docs/html/SchemaValueClass.html +++ b/docs/html/SchemaValueClass.html @@ -289,7 +289,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemaValueTag.html b/docs/html/SchemaValueTag.html index 52cc4a59..242f6c64 100644 --- a/docs/html/SchemaValueTag.html +++ b/docs/html/SchemaValueTag.html @@ -289,7 +289,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/Schemas.html b/docs/html/Schemas.html index 92adb4ad..3616ac8e 100644 --- a/docs/html/Schemas.html +++ b/docs/html/Schemas.html @@ -408,7 +408,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SchemasSpec.html b/docs/html/SchemasSpec.html index 4254de38..d78ef9fe 100644 --- a/docs/html/SchemasSpec.html +++ b/docs/html/SchemasSpec.html @@ -251,7 +251,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/SubstringSpec.html b/docs/html/SubstringSpec.html index ed9fd2e8..342820a1 100644 --- a/docs/html/SubstringSpec.html +++ b/docs/html/SubstringSpec.html @@ -189,7 +189,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/TagSpec.html b/docs/html/TagSpec.html index 26af9100..f0b272a8 100644 --- a/docs/html/TagSpec.html +++ b/docs/html/TagSpec.html @@ -213,7 +213,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_schema.js.html b/docs/html/bids_schema.js.html index 3493da34..4b3717d3 100644 --- a/docs/html/bids_schema.js.html +++ b/docs/html/bids_schema.js.html @@ -233,7 +233,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_tsvParser.js.html b/docs/html/bids_tsvParser.js.html index f1c124a2..9f4826c0 100644 --- a/docs/html/bids_tsvParser.js.html +++ b/docs/html/bids_tsvParser.js.html @@ -188,7 +188,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_types_dataset.js.html b/docs/html/bids_types_dataset.js.html index 72eb3020..e473f209 100644 --- a/docs/html/bids_types_dataset.js.html +++ b/docs/html/bids_types_dataset.js.html @@ -163,7 +163,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_types_file.js.html b/docs/html/bids_types_file.js.html index 92f016fb..dd01c9f2 100644 --- a/docs/html/bids_types_file.js.html +++ b/docs/html/bids_types_file.js.html @@ -206,7 +206,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_types_issues.js.html b/docs/html/bids_types_issues.js.html index 114629cd..0a62e68f 100644 --- a/docs/html/bids_types_issues.js.html +++ b/docs/html/bids_types_issues.js.html @@ -247,7 +247,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_types_json.js.html b/docs/html/bids_types_json.js.html index a2d0ac51..6dbe8292 100644 --- a/docs/html/bids_types_json.js.html +++ b/docs/html/bids_types_json.js.html @@ -22,7 +22,7 @@

    Source: bids/types/json.js

    import isPlainObject from 'lodash/isPlainObject'
     
     import { sidecarValueHasHed } from '../utils'
    -import { parseHedString } from '../../parser/parser'
    +import { parse } from '../../parser/parser'
     import ParsedHedString from '../../parser/parsedHedString'
     import { BidsFile } from './file'
     import BidsHedSidecarValidator from '../validator/sidecarValidator'
    @@ -359,7 +359,7 @@ 

    Source: bids/types/json.js

    * The value strings cannot contain definitions. */ _parseValueString(hedSchemas) { - const [parsedString, parsingIssues] = parseHedString(this.valueString, hedSchemas, false, true) + const [parsedString, parsingIssues] = parse(this.valueString, hedSchemas, false, true) this.parsedValueString = parsedString return parsingIssues } @@ -383,7 +383,7 @@

    Source: bids/types/json.js

    file: this.sidecar?.file?.relativePath, }) } - const [parsedString, parsingIssues] = parseHedString(string, hedSchemas, true, true) + const [parsedString, parsingIssues] = parse(string, hedSchemas, true, true) this.parsedCategoryMap.set(value, parsedString) issues.push(...parsingIssues) if (parsingIssues.length === 0) { @@ -525,7 +525,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_types_tsv.js.html b/docs/html/bids_types_tsv.js.html index 8f12e241..4b18e60e 100644 --- a/docs/html/bids_types_tsv.js.html +++ b/docs/html/bids_types_tsv.js.html @@ -310,7 +310,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_utils.js.html b/docs/html/bids_utils.js.html index 341ca760..ae4dc647 100644 --- a/docs/html/bids_utils.js.html +++ b/docs/html/bids_utils.js.html @@ -135,7 +135,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_validate.js.html b/docs/html/bids_validate.js.html index b28ce8c7..714d5043 100644 --- a/docs/html/bids_validate.js.html +++ b/docs/html/bids_validate.js.html @@ -262,7 +262,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_validator_sidecarValidator.js.html b/docs/html/bids_validator_sidecarValidator.js.html index 07e541d9..de1e6a08 100644 --- a/docs/html/bids_validator_sidecarValidator.js.html +++ b/docs/html/bids_validator_sidecarValidator.js.html @@ -287,7 +287,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_validator_tsvValidator.js.html b/docs/html/bids_validator_tsvValidator.js.html index faa03a45..734bc228 100644 --- a/docs/html/bids_validator_tsvValidator.js.html +++ b/docs/html/bids_validator_tsvValidator.js.html @@ -22,7 +22,7 @@

    Source: bids/validator/tsvValidator.js

    import { BidsHedIssue, BidsIssue } from '../types/issues'
     import { BidsTsvElement, BidsTsvRow } from '../types/tsv'
     import { BidsValidator } from './validator'
    -import { parseHedString } from '../../parser/parser'
    +import { parse } from '../../parser/parser'
     import ParsedHedString from '../../parser/parsedHedString'
     import { generateIssue } from '../../issues/issues'
     import { ReservedChecker } from '../../parser/reservedChecker'
    @@ -111,7 +111,7 @@ 

    Source: bids/validator/tsvValidator.js

    // Find basic parsing issues and return if unable to parse the string. (Warnings are okay.) const issues = [] - const [parsedString, parsingIssues] = parseHedString(hedString, this.hedSchemas, false, false) + const [parsedString, parsingIssues] = parse(hedString, this.hedSchemas, false, false) issues.push(...BidsHedIssue.fromHedIssues(parsingIssues, this.bidsFile.file, { tsvLine: rowIndex })) if (parsedString === null) { return issues @@ -203,7 +203,7 @@

    Source: bids/validator/tsvValidator.js

    } // Assemble the HED strings associated with same onset into single string. Use the parse duplicate detection. const rowString = elementList.map((element) => element.hedString).join(',') - const [parsedString, parsingIssues] = parseHedString(rowString, this.hedSchemas, false, false) + const [parsedString, parsingIssues] = parse(rowString, this.hedSchemas, false, false) if (parsingIssues.length > 0) { const tsvLines = BidsTsvElement.getTsvLines(elementList) issues.push(...BidsHedIssue.fromHedIssues(parsingIssues, this.bidsFile.file, { tsvLine: tsvLines })) @@ -339,7 +339,7 @@

    Source: bids/validator/tsvValidator.js

    // Add the parsed HED strings to the elements and quite if there are serious errors const cummulativeIssues = [] for (const element of elements) { - const [parsedHedString, parsingIssues] = parseHedString(element.hedString, this.hedSchemas, false, false) + const [parsedHedString, parsingIssues] = parse(element.hedString, this.hedSchemas, false, false) element.parsedHedString = parsedHedString if (parsingIssues.length > 0) { cummulativeIssues.push( @@ -630,7 +630,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/bids_validator_validator.js.html b/docs/html/bids_validator_validator.js.html index 2c02f740..5b139e9d 100644 --- a/docs/html/bids_validator_validator.js.html +++ b/docs/html/bids_validator_validator.js.html @@ -167,7 +167,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/global.html b/docs/html/global.html index a6ca1745..18769a6a 100644 --- a/docs/html/global.html +++ b/docs/html/global.html @@ -2761,7 +2761,7 @@
    Returns:

    - parseHedStringparse(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed) → {Array}

    @@ -3752,7 +3752,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/index.html b/docs/html/index.html index de0bdc84..fd2e379d 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -122,7 +122,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/issues_issues.js.html b/docs/html/issues_issues.js.html index 0970b89e..24e73374 100644 --- a/docs/html/issues_issues.js.html +++ b/docs/html/issues_issues.js.html @@ -286,7 +286,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/module.exports_module.exports.html b/docs/html/module.exports_module.exports.html index 7b1899e9..b0af1883 100644 --- a/docs/html/module.exports_module.exports.html +++ b/docs/html/module.exports_module.exports.html @@ -248,7 +248,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/module.html#.exports b/docs/html/module.html#.exports index a3a994cd..cd055c35 100644 --- a/docs/html/module.html#.exports +++ b/docs/html/module.html#.exports @@ -10931,7 +10931,7 @@
    diff --git a/docs/html/parser_definitionChecker.js.html b/docs/html/parser_definitionChecker.js.html index ab12e315..776974ef 100644 --- a/docs/html/parser_definitionChecker.js.html +++ b/docs/html/parser_definitionChecker.js.html @@ -316,7 +316,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_definitionManager.js.html b/docs/html/parser_definitionManager.js.html index 15ef5ee2..52adf450 100644 --- a/docs/html/parser_definitionManager.js.html +++ b/docs/html/parser_definitionManager.js.html @@ -20,7 +20,7 @@

    Source: parser/definitionManager.js

    import { generateIssue, IssueError } from '../issues/issues'
    -import { parseHedString } from './parser'
    +import { parse } from './parser'
     import { filterByTagName } from './parseUtils'
     
     export class Definition {
    @@ -91,7 +91,7 @@ 

    Source: parser/definitionManager.js

    return [this.defContents.normalized, []] } const evalString = this.defContents.originalTag.replace('#', tag._splitValue) - const [normalizedValue, issues] = parseHedString(evalString, hedSchema, false, false) + const [normalizedValue, issues] = parse(evalString, hedSchema, false, false) if (issues.length > 0) { return [null, issues] } @@ -130,7 +130,7 @@

    Source: parser/definitionManager.js

    * @returns {Array} - Returns [Definition, Issue[]] with the definition and any issues. */ static createDefinition(hedString, hedSchemas) { - const [parsedString, issues] = parseHedString(hedString, hedSchemas, true, true) + const [parsedString, issues] = parse(hedString, hedSchemas, true, true) if (issues.length > 0) { return [null, issues] } @@ -442,7 +442,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_eventManager.js.html b/docs/html/parser_eventManager.js.html index 4a8d4815..534a54d5 100644 --- a/docs/html/parser_eventManager.js.html +++ b/docs/html/parser_eventManager.js.html @@ -309,7 +309,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_parseUtils.js.html b/docs/html/parser_parseUtils.js.html index 10844180..9c97bd31 100644 --- a/docs/html/parser_parseUtils.js.html +++ b/docs/html/parser_parseUtils.js.html @@ -217,7 +217,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_parsedHedColumnSplice.js.html b/docs/html/parser_parsedHedColumnSplice.js.html index beb1d942..ba50c5d5 100644 --- a/docs/html/parser_parsedHedColumnSplice.js.html +++ b/docs/html/parser_parsedHedColumnSplice.js.html @@ -166,7 +166,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_parsedHedGroup.js.html b/docs/html/parser_parsedHedGroup.js.html index bdfd6225..ea233299 100644 --- a/docs/html/parser_parsedHedGroup.js.html +++ b/docs/html/parser_parsedHedGroup.js.html @@ -387,7 +387,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_parsedHedString.js.html b/docs/html/parser_parsedHedString.js.html index 41510f83..d4181544 100644 --- a/docs/html/parser_parsedHedString.js.html +++ b/docs/html/parser_parsedHedString.js.html @@ -240,7 +240,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_parsedHedSubstring.js.html b/docs/html/parser_parsedHedSubstring.js.html index 22990899..b4193993 100644 --- a/docs/html/parser_parsedHedSubstring.js.html +++ b/docs/html/parser_parsedHedSubstring.js.html @@ -183,7 +183,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_parsedHedTag.js.html b/docs/html/parser_parsedHedTag.js.html index acd2107e..a7ee578c 100644 --- a/docs/html/parser_parsedHedTag.js.html +++ b/docs/html/parser_parsedHedTag.js.html @@ -462,7 +462,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_parser.js.html b/docs/html/parser_parser.js.html index 3a74b296..ad6e290c 100644 --- a/docs/html/parser_parser.js.html +++ b/docs/html/parser_parser.js.html @@ -72,7 +72,7 @@

    Source: parser/parser.js

    * Parse a full HED string. * @returns {Array} - [ParsedHedString|null, Issue[]] representing the parsed HED string and any parsing issues. */ - parseHedString() { + parse() { if (this.hedString === null || this.hedString === undefined) { return [null, [generateIssue('invalidTagString', {})]] } @@ -151,7 +151,7 @@

    Source: parser/parser.js

    hedSchemas, definitionsAllowed, placeholdersAllowed, - ).parseHedString() + ).parse() parsedStrings.push(parsedString) cumulativeIssues.push(...currentIssues) } @@ -169,8 +169,8 @@

    Source: parser/parser.js

    * @param {boolean} placeholdersAllowed - True if placeholders are allowed. * @returns {Array} - [ParsedHedString, Issue[]] representing the parsed HED string and any issues found. */ -export function parseHedString(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed) { - return new HedStringParser(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed).parseHedString() +export function parse(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed) { + return new HedStringParser(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed).parse() } /** @@ -292,7 +292,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_reservedChecker.js.html b/docs/html/parser_reservedChecker.js.html index b4571c36..919b6f85 100644 --- a/docs/html/parser_reservedChecker.js.html +++ b/docs/html/parser_reservedChecker.js.html @@ -424,7 +424,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_splitter.js.html b/docs/html/parser_splitter.js.html index df910a27..6b9ada54 100644 --- a/docs/html/parser_splitter.js.html +++ b/docs/html/parser_splitter.js.html @@ -248,7 +248,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_tagConverter.js.html b/docs/html/parser_tagConverter.js.html index b26d734c..5a34550f 100644 --- a/docs/html/parser_tagConverter.js.html +++ b/docs/html/parser_tagConverter.js.html @@ -298,7 +298,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/parser_tokenizer.js.html b/docs/html/parser_tokenizer.js.html index 3e63795a..163f9661 100644 --- a/docs/html/parser_tokenizer.js.html +++ b/docs/html/parser_tokenizer.js.html @@ -527,7 +527,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_config.js.html b/docs/html/schema_config.js.html index efd98c7f..1590e903 100644 --- a/docs/html/schema_config.js.html +++ b/docs/html/schema_config.js.html @@ -139,7 +139,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_containers.js.html b/docs/html/schema_containers.js.html index 2f8429b8..73553329 100644 --- a/docs/html/schema_containers.js.html +++ b/docs/html/schema_containers.js.html @@ -350,7 +350,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_entries.js.html b/docs/html/schema_entries.js.html index 1ed383da..968bdd8c 100644 --- a/docs/html/schema_entries.js.html +++ b/docs/html/schema_entries.js.html @@ -1111,7 +1111,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_init.js.html b/docs/html/schema_init.js.html index 6ddc4f6f..61d30e2a 100644 --- a/docs/html/schema_init.js.html +++ b/docs/html/schema_init.js.html @@ -183,7 +183,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_loader.js.html b/docs/html/schema_loader.js.html index c291cfde..8d9e0a0d 100644 --- a/docs/html/schema_loader.js.html +++ b/docs/html/schema_loader.js.html @@ -242,7 +242,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_parser.js.html b/docs/html/schema_parser.js.html index 30727993..c1762e88 100644 --- a/docs/html/schema_parser.js.html +++ b/docs/html/schema_parser.js.html @@ -626,7 +626,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_schemaMerger.js.html b/docs/html/schema_schemaMerger.js.html index fc75053f..674f8abf 100644 --- a/docs/html/schema_schemaMerger.js.html +++ b/docs/html/schema_schemaMerger.js.html @@ -295,7 +295,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/schema_specs.js.html b/docs/html/schema_specs.js.html index c2aa4dea..c33e1335 100644 --- a/docs/html/schema_specs.js.html +++ b/docs/html/schema_specs.js.html @@ -226,7 +226,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_array.js.html b/docs/html/utils_array.js.html index 03ae7c65..76c4001e 100644 --- a/docs/html/utils_array.js.html +++ b/docs/html/utils_array.js.html @@ -158,7 +158,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_files.js.html b/docs/html/utils_files.js.html index 051bd4a0..030d8426 100644 --- a/docs/html/utils_files.js.html +++ b/docs/html/utils_files.js.html @@ -161,7 +161,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_hedData.js.html b/docs/html/utils_hedData.js.html index 223b10ce..740b6ae9 100644 --- a/docs/html/utils_hedData.js.html +++ b/docs/html/utils_hedData.js.html @@ -143,7 +143,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_hedStrings.js.html b/docs/html/utils_hedStrings.js.html index 14a1d5bb..825401b2 100644 --- a/docs/html/utils_hedStrings.js.html +++ b/docs/html/utils_hedStrings.js.html @@ -202,7 +202,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_memoizer.js.html b/docs/html/utils_memoizer.js.html index e5576a68..b7976610 100644 --- a/docs/html/utils_memoizer.js.html +++ b/docs/html/utils_memoizer.js.html @@ -172,7 +172,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_string.js.html b/docs/html/utils_string.js.html index 2fecff1f..02463c05 100644 --- a/docs/html/utils_string.js.html +++ b/docs/html/utils_string.js.html @@ -212,7 +212,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_xml2js.js.html b/docs/html/utils_xml2js.js.html index 2db6a6bd..42d210f5 100644 --- a/docs/html/utils_xml2js.js.html +++ b/docs/html/utils_xml2js.js.html @@ -158,7 +158,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/docs/html/utils_xpath.js.html b/docs/html/utils_xpath.js.html index 3401fdc2..f21711e0 100644 --- a/docs/html/utils_xpath.js.html +++ b/docs/html/utils_xpath.js.html @@ -207,7 +207,7 @@

    Global

  • localSchemaList
  • mergeSchemas
  • normalized
  • -
  • parseHedString
  • +
  • parse
  • parseHedStrings
  • parseSchemaXML
  • parseTSV
  • diff --git a/src/bids/types/file.js b/src/bids/types/file.js index ca5b3519..3b53c9b9 100644 --- a/src/bids/types/file.js +++ b/src/bids/types/file.js @@ -36,30 +36,53 @@ export class BidsFile { this._validatorClass = validatorClass } + // /** + // * Parse this bidsFile's HED strings within the bidsFile structure. + // * + // * @param {Schemas} hedSchemas - The HED schema collection. + // * @returns {Array} [Issue[], Issue[]] Any errors and warnings found + // */ + // parseHed(hedSchemas) { + // return [[], []] + // } + + /** + * Whether this is a TSV file timeline file. + * + * @returns {boolean} + */ + get isTimelineFile() { + return false + } + /** * Validate this validator's tsv file. * * @param {Schemas} schemas - The HED schemas used to validate this file. - * @returns {BidsHedIssue[]} - Any issues found during validation of this TSV file. + * @returns {BidsHedIssue[], BidsHedIssue[]} - Any issues found during validation of this TSV file. */ validate(schemas) { if (!this.hasHedData) { return [] } if (!schemas) { - BidsHedIssue.fromHedIssue( - generateIssue('missingSchemaSpecification', { - message: 'No valid HED schema specification was supplied.', - }), - { path: this.file.file, relativePath: this.file.file }, - ) + return [ + BidsHedIssue.fromHedIssue( + generateIssue('missingSchemaSpecification', { + message: 'No valid HED schema specification was supplied.', + }), + { path: this.file.file, relativePath: this.file.file }, + ), + ] } try { const validator = new this.validatorClass(this, schemas) - return validator.validate() - } catch (internalError) { - return BidsHedIssue.fromHedIssues(internalError, this.file) + validator.validate() + return [...validator.errors, ...validator.warnings] + } catch (error) { + // The low-level parsing throws exceptions with the issue encapsulated. + return BidsHedIssue.fromHedIssues(error, this.file) } } diff --git a/src/bids/types/issues.js b/src/bids/types/issues.js index a398b511..04715638 100644 --- a/src/bids/types/issues.js +++ b/src/bids/types/issues.js @@ -1,7 +1,5 @@ import { generateIssue, IssueError } from '../../issues/issues' -const bidsHedErrorCodes = new Set(['HED_ERROR', 'HED_INTERNAL_ERROR']) - export class BidsHedIssue { /** * The BIDS issue code. @@ -52,7 +50,7 @@ export class BidsHedIssue { * @returns {boolean} */ get isError() { - return bidsHedErrorCodes.has(this.bidsCode) + return this.hedIssue.level === 'error' } /** @@ -65,15 +63,10 @@ export class BidsHedIssue { return issues.some((issue) => issue.isError) } - /** - * Generate a {@link Promise} with an internal error. - * - * @param {string} error The error message. - * @param {Object} errorFile The file this error occurred in. - * @return {Promise} A promise resolving to a singleton array containing an internal error {@link BidsHedIssue}. - */ - static async generateInternalErrorPromise(error, errorFile) { - return [new BidsHedIssue(generateIssue('internalError', { message: error.message }), errorFile)] + static splitErrors(issues) { + const errors = issues.filter((item) => item.isError) + const warnings = issues.filter((item) => !item.isError) + return [errors, warnings] } /** @@ -102,7 +95,9 @@ export class BidsHedIssue { * @returns {BidsHedIssue[]} The passed issue(s) in BIDS-compatible format. */ static fromHedIssues(hedIssues, file, extraParameters) { - if (hedIssues instanceof IssueError) { + if (hedIssues.length === 0) { + return [] + } else if (hedIssues instanceof IssueError) { return [BidsHedIssue.fromHedIssue(hedIssues.issue, file, extraParameters)] } else if (hedIssues instanceof Error) { return [new BidsHedIssue(generateIssue('internalError', { message: hedIssues.message }), file ?? null)] diff --git a/src/bids/types/json.js b/src/bids/types/json.js index 7e82d73c..c61084d5 100644 --- a/src/bids/types/json.js +++ b/src/bids/types/json.js @@ -190,13 +190,16 @@ export class BidsSidecar extends BidsJsonFile { * The parsed strings are placed into {@link parsedHedData}. * * @param {Schemas} hedSchemas - The HED schema collection. - * @returns {Issue[]} Any issues found. + * @returns {Array} [Issue[], Issue[]] Any errors and warnings found */ - parseHedStrings(hedSchemas) { + parseHed(hedSchemas) { this.parsedHedData = new Map() - const issues = [] + const errors = [] + const warnings = [] for (const [name, sidecarKey] of this.sidecarKeys.entries()) { - issues.push(...sidecarKey.parseHed(hedSchemas)) + const [errorIssues, warningIssues] = sidecarKey.parseHed(hedSchemas) + errors.push(...errorIssues) + warnings.push(...warningIssues) if (sidecarKey.isValueKey) { this.parsedHedData.set(name, sidecarKey.parsedValueString) } else { @@ -204,7 +207,7 @@ export class BidsSidecar extends BidsJsonFile { } } this._generateSidecarColumnSpliceMap() - return issues + return [errors, warnings] } /** @@ -277,32 +280,41 @@ export class BidsSidecarKey { * @type {string} */ name + /** * The unparsed category mapping. * @type {Object} */ categoryMap + /** * The parsed category mapping. * @type {Map} */ parsedCategoryMap + /** * The unparsed value string. * @type {string} */ valueString + /** * The parsed value string. * @type {ParsedHedString} */ parsedValueString + /** * Weak reference to the bidsFile. * @type {BidsSidecar} */ sidecar + /** + * Indication of whether this key is for definitions. + * @type {Boolean} + */ hasDefinitions /** @@ -328,8 +340,10 @@ export class BidsSidecarKey { /** * Parse the HED data for this key. * + * ###Note: This sets the parsedHedData as a side effect. + * * @param {Schemas} hedSchemas The HED schema collection. - * @returns {Issue[]} Any issues found. + * @returns {Array} - [Issue[], Issues[]] Errors and warnings that result from parsing. */ parseHed(hedSchemas) { if (this.isValueKey) { @@ -345,24 +359,25 @@ export class BidsSidecarKey { * The value strings cannot contain definitions. * * @param {Schemas} hedSchemas - The HED schemas to use. - * @returns {Issue[]} + * @returns {Array} - [Issue[], Issue[]] - Errors due for the value. * @private */ _parseValueString(hedSchemas) { - const [parsedString, parsingIssues] = parseHedString(this.valueString, hedSchemas, false, true) + const [parsedString, errors, warnings] = parseHedString(this.valueString, hedSchemas, false, true) this.parsedValueString = parsedString - return parsingIssues + return [errors, warnings] } /** * Parse the categorical values associated with this key. * @param {Schemas} hedSchemas - The HED schemas used to check against. - * @returns {Issue[]} - A list of issues if any + * @returns {Array} - Array[Issue[], Issue[]] A list of error issues and warning issues. * @private */ _parseCategory(hedSchemas) { - const issues = [] this.parsedCategoryMap = new Map() + const errors = [] + const warnings = [] for (const [value, string] of Object.entries(this.categoryMap)) { const trimmedValue = value.trim() if (ILLEGAL_SIDECAR_KEYS.has(trimmedValue.toLowerCase())) { @@ -373,18 +388,25 @@ export class BidsSidecarKey { file: this.sidecar?.file?.relativePath, }) } - const [parsedString, parsingIssues] = parseHedString(string, hedSchemas, true, true) + const [parsedString, errorIssues, warningIssues] = parseHedString(string, hedSchemas, true, true) this.parsedCategoryMap.set(value, parsedString) - issues.push(...parsingIssues) - if (parsingIssues.length === 0) { - issues.push(...this._checkDefinitions(parsedString)) + warnings.push(...warningIssues) + errors.push(...errorIssues) + if (errorIssues.length === 0) { + errors.push(...this._checkDefinitions(parsedString)) } } - return issues + return [errors, warnings] } + /** + * Check for definitions in the HED string. + * @param {ParsedHedString} parsedString - The string to check for definitions. + * @returns {Issue[]} - Errors that occur. + * @private + */ _checkDefinitions(parsedString) { - const issues = [] + const errors = [] for (const group of parsedString.tagGroups) { if (!group.isDefinitionGroup) { continue @@ -392,12 +414,12 @@ export class BidsSidecarKey { this.hasDefinitions = true const [def, defIssues] = Definition.createDefinitionFromGroup(group) if (defIssues.length > 0) { - issues.push(...defIssues) + errors.push(...defIssues) } else { - issues.push(...this.sidecar.definitions.addDefinition(def)) + errors.push(...this.sidecar.definitions.addDefinition(def)) } } - return issues + return errors } /** diff --git a/src/bids/validator/sidecarValidator.js b/src/bids/validator/sidecarValidator.js index 8f594553..189d3f5b 100644 --- a/src/bids/validator/sidecarValidator.js +++ b/src/bids/validator/sidecarValidator.js @@ -19,22 +19,19 @@ export class BidsHedSidecarValidator extends BidsValidator { } /** - * Validate a BIDS JSON bidsFile file. This method returns the complete issue list for convenience. + * Validate a BIDS JSON bidsFile file. Errors and warnings are stored. * - * @returns {BidsHedIssue[]} - Any issues found during validation of this bidsFile file. */ validate() { // Allow schema to be set a validation time -- this is checked by the superclass of BIDS file - const sidecarParsingIssues = BidsHedIssue.fromHedIssues( - this.bidsFile.parseHedStrings(this.hedSchemas), - this.bidsFile.file, - ) - this.issues.push(...sidecarParsingIssues) - if (sidecarParsingIssues.length > 0) { - return this.issues + const [errorIssues, warningIssues] = this.bidsFile.parseHed(this.hedSchemas) + this.errors.push(...BidsHedIssue.fromHedIssues(errorIssues, this.bidsFile.file)) + this.warnings.push(...BidsHedIssue.fromHedIssues(warningIssues, this.bidsFile.file)) + if (errorIssues.length > 0) { + return } - this.issues.push(...this._validateStrings(), ...this._validateCurlyBraces()) - return this.issues + + this.errors.push(...this._validateStrings(), ...this._validateCurlyBraces()) } /** diff --git a/src/bids/validator/tsvValidator.js b/src/bids/validator/tsvValidator.js index 91eac32a..4b0fba80 100644 --- a/src/bids/validator/tsvValidator.js +++ b/src/bids/validator/tsvValidator.js @@ -32,47 +32,49 @@ export class BidsHedTsvValidator extends BidsValidator { /** * Validate a BIDS TSV file. This method returns the complete issue list for convenience. * - * @returns {BidsHedIssue[]} - Any issues found during validation of this TSV file. */ validate() { - // Validate the BIDS bidsFile if it exists. + // Validate the BIDS bidsFile if it exists and return if there are errors if (this.bidsFile.mergedSidecar) { - const sidecarIssues = this.bidsFile.mergedSidecar.validate(this.hedSchemas) - this.issues.push(...sidecarIssues) - if (BidsHedIssue.anyAreErrors(sidecarIssues)) { - return this.issues + const issues = this.bidsFile.mergedSidecar.validate(this.hedSchemas) + const [errorIssues, warningIssues] = BidsHedIssue.splitErrors(issues) + this.errors.push(...errorIssues) + this.warnings.push(...warningIssues) + if (this.errors.length > 0) { + return } } // Valid the HED column by itself. - const hedColumnIssues = this._validateHedColumn() - this.issues.push(...hedColumnIssues) - if (BidsHedIssue.anyAreErrors(this.issues)) { - return this.issues + this._validateHedColumn() + if (this.errors.length > 0) { + return } // Now do a full validation const bidsHedTsvParser = new BidsHedTsvParser(this.bidsFile, this.hedSchemas) - const [bidsEvents, parsingIssues] = bidsHedTsvParser.parse() - this.issues.push(...parsingIssues) - if (!BidsHedIssue.anyAreErrors(this.issues)) { - this.issues.push(...this.validateDataset(bidsEvents)) + const [bidsEvents, errorIssues, warningIssues] = bidsHedTsvParser.parse() + this.errors.push(...errorIssues) + this.warnings.push(...warningIssues) + if (this.errors.length > 0) { + return + } + this.validateDataset(bidsEvents) + if (this.errors.length === 0) { + //this.issues.push(...this.check_missing_keys()) } - return this.issues } /** * Validate this TSV file's HED column. * - * @returns {BidsHedIssue[]} - Issues found in validating the HED column without sidecar information. * @private */ _validateHedColumn() { - if (this.bidsFile.hedColumnHedStrings.length === 0) { - return [] + if (this.bidsFile.hedColumnHedStrings.length > 0) { + this.bidsFile.hedColumnHedStrings.flatMap((hedString, rowIndexMinusTwo) => + this._validateHedColumnString(hedString, rowIndexMinusTwo + 2), + ) } - return this.bidsFile.hedColumnHedStrings.flatMap((hedString, rowIndexMinusTwo) => - this._validateHedColumnString(hedString, rowIndexMinusTwo + 2), - ) } /** @@ -80,25 +82,24 @@ export class BidsHedTsvValidator extends BidsValidator { * * @param {string} hedString - The string to be validated. * @param {number} rowIndex - The index of this row in the TSV file. - * @returns {BidsHedIssue[]} - Specific issues found in validating the HED column * @private */ _validateHedColumnString(hedString, rowIndex) { if (!hedString) { - return [] + return } // Find basic parsing issues and return if unable to parse the string. (Warnings are okay.) - const issues = [] - const [parsedString, parsingIssues] = parseHedString(hedString, this.hedSchemas, false, false) - issues.push(...BidsHedIssue.fromHedIssues(parsingIssues, this.bidsFile.file, { tsvLine: rowIndex })) + const [parsedString, errorIssues, warningIssues] = parseHedString(hedString, this.hedSchemas, false, false) + this.errors.push(...BidsHedIssue.fromHedIssues(errorIssues, this.bidsFile.file, { tsvLine: rowIndex })) + this.warnings.push(...BidsHedIssue.fromHedIssues(warningIssues, this.bidsFile.file, { tsvLine: rowIndex })) if (parsedString === null) { - return issues + return } // The HED column is not allowed to have column splices. if (parsedString.columnSplices.length > 0) { - issues.push( + this.errors.push( BidsHedIssue.fromHedIssue( generateIssue('curlyBracesInHedColumn', { string: parsedString.hedString, @@ -107,7 +108,7 @@ export class BidsHedTsvValidator extends BidsValidator { this.bidsFile.file, ), ) - return issues + return } // Check whether definitions used exist and are used correctly. @@ -115,36 +116,31 @@ export class BidsHedTsvValidator extends BidsValidator { ...this.bidsFile.mergedSidecar.definitions.validateDefs(parsedString, this.hedSchemas, false), ...this.bidsFile.mergedSidecar.definitions.validateDefExpands(parsedString, this.hedSchemas, false), ] - const convertedIssues = BidsHedIssue.fromHedIssues(defIssues, this.bidsFile.file, { tsvLine: rowIndex }) - issues.push(...convertedIssues) - return issues + this.errors.push(...BidsHedIssue.fromHedIssues(defIssues, this.bidsFile.file, { tsvLine: rowIndex })) } /** * Validate the HED data in a combined event TSV file/bidsFile BIDS data collection. - * - * @param {BidsTsvElement[]} elements - The element objects, which include the strings and row information. - * @returns {BidsHedIssue[]} - The errors resulting from final validation, including dataset-level checks. */ validateDataset(elements) { // Final top-tag detection cannot be done until the strings are fully assembled and finalized. - const issues = this._checkNoTopTags(elements) - if (issues.length > 0) { - return issues + this._checkNoTopTags(elements) + if (this.errors.length > 0) { + return } // Temporal files have to check Onset, Inset, Offset consistency. if (this.bidsFile.isTimelineFile) { - return this._validateTemporal(elements) + this._validateTemporal(elements) + } else { + // Non-temporal files cannot have temporal tags. + this._checkNoTime(elements) } - // Non-temporal files cannot have temporal tags. - return this._checkNoTime(elements) } /** * Check the temporal relationships among events. * * @param {BidsTsvElement[]} elements - The elements representing the tsv file. - * @returns {BidsHedIssue[]} - Errors in temporal relationships among events. * @private */ _validateTemporal(elements) { @@ -152,14 +148,14 @@ export class BidsHedTsvValidator extends BidsValidator { const eventManager = new EventManager() const [eventList, temporalIssues] = eventManager.parseEvents(elements) if (temporalIssues.length > 0) { - return temporalIssues + this.errors.push(...temporalIssues) + return } // There still may be non-temporal duplicates when multiple rows with the same onset. - const duplicateErrors = this._checkDuplicatesAcrossRows(elements) - if (duplicateErrors.length > 0) { - return duplicateErrors + this._checkDuplicatesAcrossRows(elements) + if (this.errors.length === 0) { + this.errors.push(...eventManager.validate(eventList)) } - return eventManager.validate(eventList) } /** @@ -175,20 +171,17 @@ export class BidsHedTsvValidator extends BidsValidator { */ _checkDuplicatesAcrossRows(elements) { const duplicateMap = this._getOnsetMap(elements) - const issues = [] for (const elementList of duplicateMap.values()) { if (elementList.length === 1) { continue } // Assemble the HED strings associated with same onset into single string. Use the parse duplicate detection. const rowString = elementList.map((element) => element.hedString).join(',') - const [parsedString, parsingIssues] = parseHedString(rowString, this.hedSchemas, false, false) - if (parsingIssues.length > 0) { - const tsvLines = BidsTsvElement.getTsvLines(elementList) - issues.push(...BidsHedIssue.fromHedIssues(parsingIssues, this.bidsFile.file, { tsvLine: tsvLines })) - } + const [parsedString, errorIssues, warningIssues] = parseHedString(rowString, this.hedSchemas, false, false) + const tsvLines = BidsTsvElement.getTsvLines(elementList) + this.errors.push(...BidsHedIssue.fromHedIssues(errorIssues, this.bidsFile.file, { tsvLine: tsvLines })) + this.warnings.push(...BidsHedIssue.fromHedIssues(warningIssues, this.bidsFile.file, { tsvLine: tsvLines })) } - return issues } /** @@ -217,16 +210,14 @@ export class BidsHedTsvValidator extends BidsValidator { * Top group tag requirements may not be satisfied until all splices have been done. * * @param {BidsTsvElement[]} elements - The elements to be checked. - * @returns {BidsHedIssue[]} - Issues from final check of top groups. * @private */ _checkNoTopTags(elements) { - const topGroupIssues = [] for (const element of elements) { const topTags = element.parsedHedString ? element.parsedHedString.topLevelTags : [] const badTags = topTags.filter((tag) => ReservedChecker.hasTopLevelTagGroupAttribute(tag)) if (badTags.length > 0) { - topGroupIssues.push( + this.errors.push( BidsHedIssue.fromHedIssue( generateIssue('invalidTopLevelTag', { tag: getTagListString(badTags), string: element.hedString }), element.file, @@ -235,20 +226,17 @@ export class BidsHedTsvValidator extends BidsValidator { ) } } - return topGroupIssues } /** * Verify that this non-temporal file does not contain any temporal tags. * * @param {BidsTsvElement[]} elements - The elements representing a tsv file (with HED string parsed). - * @returns {BidsHedIssue[]} - Issues from checking non-temporal files for temporal tags. */ _checkNoTime(elements) { - const timeIssues = [] for (const element of elements) { if (element.parsedHedString.tags.some((tag) => this.reserved.timelineTags.has(tag.schemaTag.name))) { - timeIssues.push( + this.errors.push( BidsHedIssue.fromHedIssue( generateIssue('temporalTagInNonTemporalContext', { string: element.hedString, tsvLine: element.tsvLine }), this.bidsFile.file, @@ -256,7 +244,6 @@ export class BidsHedTsvValidator extends BidsValidator { ) } } - return timeIssues } } @@ -295,44 +282,47 @@ export class BidsHedTsvParser { /** * Combine the BIDS bidsFile HED data into a BIDS TSV file's HED data. * - * @returns {Array} - Returns a two-element array [BidsTsvElement[], BidsHedIssue[]]. + * @returns {Array} - Returns a two-element array [BidsTsvElement[], BidsHedIssue[], BidsHedIssue[]]. */ parse() { const tsvHedRows = this._generateHedRows() const tsvElements = this._parseHedRows(tsvHedRows) - const parsingIssues = this._parseElementStrings(tsvElements) - return [tsvElements, parsingIssues] + const [errors, warnings] = this._parseElementStrings(tsvElements) + return [tsvElements, errors, warnings] } /** * Parse element HED strings. * * @param {BidsTsvElement[]} elements - The objects representing tsv rows with their parsed HEd strings. - * @returns {BidsHedIssue[]} - The issues resulting in creating the parsed HED strings. + * @returns {Array} - [BidsHedIssue[], BidsHedIssue[]] The errors and warnings resulting in creating the parsed HED strings. */ _parseElementStrings(elements) { if (elements.length === 0) { - return [] + return [[], []] } // Add the parsed HED strings to the elements and quite if there are serious errors - const cummulativeIssues = [] + const errors = [] + const warnings = [] for (const element of elements) { - const [parsedHedString, parsingIssues] = parseHedString(element.hedString, this.hedSchemas, false, false) + const [parsedHedString, errorIssues, warningIssues] = parseHedString( + element.hedString, + this.hedSchemas, + false, + false, + ) element.parsedHedString = parsedHedString - if (parsingIssues.length > 0) { - cummulativeIssues.push( - ...BidsHedIssue.fromHedIssues(parsingIssues, this.tsvFile.file, { tsvLine: element.tsvLine }), - ) - } + errors.push(...BidsHedIssue.fromHedIssues(errorIssues, this.tsvFile.file, { tsvLine: element.tsvLine })) + warnings.push(...BidsHedIssue.fromHedIssues(warningIssues, this.tsvFile.file, { tsvLine: element.tsvLine })) } - return cummulativeIssues + return [errors, warnings] } /** * Generate a list of rows with column-to-value mappings. * - * @returns {Array.Map} A list of single-row column-to-value mappings. + * @returns {Array} A list of single-row column-to-value mappings. * @private */ _generateHedRows() { diff --git a/src/bids/validator/validator.js b/src/bids/validator/validator.js index 18ac2713..98f523ae 100644 --- a/src/bids/validator/validator.js +++ b/src/bids/validator/validator.js @@ -16,7 +16,13 @@ export class BidsValidator { * The issues found during validation. * @type {BidsHedIssue[]} */ - issues + errors + + /** + * The warnings found during validation. + * @type {BidsHedIssue[]} + */ + warnings /** * Bids validator base class. @@ -27,15 +33,15 @@ export class BidsValidator { constructor(bidsFile, hedSchemas) { this.bidsFile = bidsFile this.hedSchemas = hedSchemas // Will be set when the file is validated - this.issues = [] + this.errors = [] + this.warnings = [] } /** - * Validate a BIDS TSV file. This method returns the complete issue list for convenience. + * Validate a BIDS file. Overridden by particular types of BIDS files. * - * @returns {BidsHedIssue[]} - Any issues found during validation of this TSV file. */ validate() { - return this.issues + return } } diff --git a/src/parser/parser.js b/src/parser/parser.js index bb357333..aca64589 100644 --- a/src/parser/parser.js +++ b/src/parser/parser.js @@ -49,48 +49,51 @@ class HedStringParser { /** * Parse a full HED string. - * @returns {Array} - [ParsedHedString|null, Issue[]] representing the parsed HED string and any parsing issues. + * + * ###Note: now separates errors and warnings for easier handling. + * + * @returns {Array} - [ParsedHedString|null, Issue[], Issue[]] representing the parsed HED string and any parsing issues. */ - parseHedString() { + parse() { if (this.hedString === null || this.hedString === undefined) { - return [null, [generateIssue('invalidTagString', {})]] + return [null, [generateIssue('invalidTagString', {})], []] } const placeholderIssues = this._getPlaceholderCountIssues() if (placeholderIssues.length > 0) { - return [null, placeholderIssues] + return [null, placeholderIssues, []] } if (this.hedString instanceof ParsedHedString) { - return [this.hedString, []] + return [this.hedString, [], []] } if (!this.hedSchemas) { - return [null, [generateIssue('missingSchemaSpecification', {})]] + return [null, [generateIssue('missingSchemaSpecification', {})], []] } // This assumes that splitter errors are only errors and not warnings const [parsedTags, parsingIssues] = new HedStringSplitter(this.hedString, this.hedSchemas).splitHedString() if (parsedTags === null || parsingIssues.length > 0) { - return [null, parsingIssues] + return [null, parsingIssues, []] } // Returns a parsed HED string unless empty const parsedString = new ParsedHedString(this.hedString, parsedTags) if (!parsedString) { - return [null, null] + return [null, null, []] } // Check the definition syntax issues const definitionIssues = new DefinitionChecker(parsedString).check(this.definitionsAllowed) if (definitionIssues.length > 0) { - return [null, definitionIssues] + return [null, definitionIssues, []] } // Check the other reserved tags requirements const checkIssues = ReservedChecker.getInstance().checkHedString(parsedString) if (checkIssues.length > 0) { - return [null, checkIssues] + return [null, checkIssues, []] } - return [parsedString, []] + return [parsedString, [], []] } /** @@ -116,50 +119,56 @@ class HedStringParser { * @param {Schemas} hedSchemas The collection of HED schemas. * @param {boolean} definitionsAllowed - True if definitions are allowed * @param {boolean} placeholdersAllowed - True if placeholders are allowed - * @returns {Array} - [ParsedHedString[], Issue[]] representing the parsed HED strings and any issues found. + * @returns {Array} - [ParsedHedString[], Issue[], Issue[]] representing the parsed HED strings and any errors and warnings. */ static parseHedStrings(hedStrings, hedSchemas, definitionsAllowed, placeholdersAllowed) { if (!hedSchemas) { - return [null, [generateIssue('missingSchemaSpecification', {})]] + return [null, [generateIssue('missingSchemaSpecification', {})], []] } const parsedStrings = [] - const cumulativeIssues = [] + const errors = [] + const warnings = [] for (const hedString of hedStrings) { - const [parsedString, currentIssues] = new HedStringParser( + const [parsedString, errorIssues, warningIssues] = new HedStringParser( hedString, hedSchemas, definitionsAllowed, placeholdersAllowed, - ).parseHedString() + ).parse() parsedStrings.push(parsedString) - cumulativeIssues.push(...currentIssues) + errors.push(...errorIssues) + warnings.push(...warningIssues) } - return [parsedStrings, cumulativeIssues] + return [parsedStrings, errors, warnings] } } /** * Parse a HED string. * + * ###Note: now separates errors and warnings for easier handling. + * * @param {string|ParsedHedString} hedString A (possibly already parsed) HED string. * @param {Schemas} hedSchemas - The collection of HED schemas. * @param {boolean} definitionsAllowed - True if definitions are allowed. * @param {boolean} placeholdersAllowed - True if placeholders are allowed. - * @returns {Array} - [ParsedHedString, Issue[]] representing the parsed HED string and any issues found. + * @returns {Array} - [ParsedHedString, Issue[], Issue[]] representing the parsed HED string and any issues found. */ export function parseHedString(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed) { - return new HedStringParser(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed).parseHedString() + return new HedStringParser(hedString, hedSchemas, definitionsAllowed, placeholdersAllowed).parse() } /** * Parse a list of HED strings. * + * ###Note: now separates errors and warnings for easier handling. + * * @param {string[]|ParsedHedString[]} hedStrings - A list of HED strings. * @param {Schemas} hedSchemas - The collection of HED schemas. * @param {boolean} definitionsAllowed - True if definitions are allowed * @param {boolean} placeholdersAllowed - True if placeholders are allowed - * @returns {Array} - [ParsedHedString[], Issue[]] representing the parsed HED strings and any issues found. + * @returns {Array} - [ParsedHedString[], Issue[], Issue[]] representing the parsed HED strings and any issues found. */ export function parseHedStrings(hedStrings, hedSchemas, definitionsAllowed, placeholdersAllowed) { return HedStringParser.parseHedStrings(hedStrings, hedSchemas, definitionsAllowed, placeholdersAllowed) diff --git a/tests/bidsTests.spec.js b/tests/bidsTests.spec.js index 992c2ffe..a0664752 100644 --- a/tests/bidsTests.spec.js +++ b/tests/bidsTests.spec.js @@ -14,7 +14,7 @@ import { DefinitionManager } from '../src/parser/definitionManager' //const skipMap = new Map([['definition-tests', ['invalid-missing-definition-for-def', 'invalid-nested-definition']]]) const skipMap = new Map() const runAll = true -const runMap = new Map([['temporal-tests', ['valid-offset-after-onset']]]) +const runMap = new Map([['curly-brace-tests', ['valid-HED-column-splice-with-n/a']]]) describe('BIDS validation', () => { const schemaMap = new Map([['8.3.0', undefined]]) diff --git a/tests/stringParserTests.spec.js b/tests/stringParserTests.spec.js index b2625b89..a67badce 100644 --- a/tests/stringParserTests.spec.js +++ b/tests/stringParserTests.spec.js @@ -42,9 +42,10 @@ describe('Null schema objects should cause parsing to bail', () => { it('Should not proceed if no schema and valid array of strings', () => { const arrayIn = ['Item, Red', 'Blue'] const expectedIssues = [generateIssue('missingSchemaSpecification', {})] - const [directParsed, directIssues] = parseHedStrings(arrayIn, null, true, false, false) + const [directParsed, directIssues, warningIssues] = parseHedStrings(arrayIn, null, true, false) assert.isNull(directParsed, `Parsed HED string of ${arrayIn} is null for invalid string`) assert.deepStrictEqual(directIssues, expectedIssues) + assert.equal(warningIssues.length, 0) }) }) diff --git a/tests/testData/bidsTests.data.js b/tests/testData/bidsTests.data.js index 0143a38e..4e566cd7 100644 --- a/tests/testData/bidsTests.data.js +++ b/tests/testData/bidsTests.data.js @@ -146,7 +146,7 @@ export const bidsTestData = [ ], }, { - testname: 'invalid-bad-tag-in-JSON', + testname: 'invalid-bad-tag-in-JSON-no-use', explanation: 'Bad tag in JSON', schemaVersion: '8.3.0', definitions: ['(Definition/Acc/#, (Acceleration/# m-per-s^2, Red))', '(Definition/MyColor, (Label/Pie))'], @@ -160,15 +160,15 @@ export const bidsTestData = [ eventsString: 'onset\tduration\tHED\n' + '7\t4\tGreen', sidecarErrors: [ BidsHedIssue.fromHedIssue(generateIssue('invalidTag', { tag: 'Baloney' }), { - path: 'invalid-bad-tag-in-JSON.json', - relativePath: 'invalid-bad-tag-in-JSON.json', + path: 'invalid-bad-tag-in-JSON-no-use.json', + relativePath: 'invalid-bad-tag-in-JSON-no-use.json', }), ], tsvErrors: [], comboErrors: [ BidsHedIssue.fromHedIssue(generateIssue('invalidTag', { tag: 'Baloney' }), { - path: 'invalid-bad-tag-in-JSON.tsv', - relativePath: 'invalid-bad-tag-in-JSON.tsv', + path: 'invalid-bad-tag-in-JSON-no-use.tsv', + relativePath: 'invalid-bad-tag-in-JSON-no-use.tsv', }), ], },