Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
P parabix-devel
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 9
    • Issues 9
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cameron
  • parabix-devel
  • Wiki
  • Bracket Matching

Bracket Matching · Changes

Page history
Update Bracket Matching authored Mar 31, 2022 by lperesde's avatar lperesde
Hide whitespace changes
Inline Side-by-side
Showing with 30 additions and 38 deletions
+30 -38
  • Bracket-Matching.md Bracket-Matching.md +30 -38
  • No files found.
Bracket-Matching.md
View page @ 5723e802
...@@ -145,44 +145,36 @@ after any value or Comma. ...@@ -145,44 +145,36 @@ after any value or Comma.
Assume we have two bit streams for tokens: `valueToken` (explained above) and `anyToken`, a bit stream marking the end position of any legal or illegal token. Assume also that `LBrace`, `RBrace`, `DQuote`, `Colon` and `Comma` are streams marking the position of JSON `{`, `}`, `"`, `:` and `,` tokens respectively. Assume we have two bit streams for tokens: `valueToken` (explained above) and `anyToken`, a bit stream marking the end position of any legal or illegal token. Assume also that `LBrace`, `RBrace`, `DQuote`, `Colon` and `Comma` are streams marking the position of JSON `{`, `}`, `"`, `:` and `,` tokens respectively.
``` ```
str = valueToken & DQuote str = valueToken & DQuote
valueTokenMinusStr = valueToken ^ str zeroND = bnc.EQ(ND, 0)
atDepth = bnc.EQ(ND, d) // process strings as both key and value
nested = bnc.UGT(ND, d) validStr = str & ~zeroND
objStart = atDepth & LBrace afterTokenStr = Advance(validStr, 1)
objEnd = ScanThru(objStart, nested | (atDepth & ~ (RBrak | RBrace))) tokenNextStr = ScanThru(afterTokenStr, whitespace)
objAtEnd = objEnd & RBrak errAfterValueStr = tokenNextStr & ~(Comma | Colon | RBrace | RBrak | zeroND)
objSpan = ExclusiveSpan(objStart, objEnd)
// Now validate that every value or nested item is followed // Every Colon must be followed by a value
// either by a comma or a the end RBrace. validBeginValues = (valueToken | LBrak | LBrace) & ~zeroND
afterNested = Advance(nested & objSpan, 1) & atDepth advColon = Advance(Colon, 1)
// errAfterColon = ScanTo(advColon, anyToken) & ~validBeginValues)
// process all values that are not strings
afterTokenMinusStr = Advance(atDepth & valueTokenMinusStr & objSpan, 1) for d in 1...MaxDepth
tokenNextMinusStr = ScanThru(afterNested | afterTokenMinusStr, whitespace) atDepth = bnc.EQ(ND, d)
errAfterValueMinusStr = tokenNextMinusStr &~(Comma | RBrace) nested = bnc.UGT(ND, d)
// objStart = atDepth & LBrace
// process strings as both key and value objEnd = ScanThru(objStart, nested | (atDepth & ~ (RBrak | RBrace)))
strAtDepth = atDepth & str objAtEnd = objEnd & RBrak
afterTokenStr = Advance(strAtDepth & objSpan, 1) objSpan = ExclusiveSpan(objStart, objEnd)
tokenNextStr = ScanThru(afterNested | afterTokenStr, whitespace) //
errAfterValueStr = tokenNextStr &~(Comma | RBrace | Colon) // Every Comma must be followed by a key string
// strAtDepth = str & atDepth
// join errors advComma = Advance(Comma & atDepth & objSpan, 1)
errAfterValue = errAfterValueMinusStr | errAfterValueStr errAfterComma = ScanTo(advComma, anyToken) & ~ strAtDepth
// //
// Every Colon must be followed by a value // After the LBrace we must have either a value or an RBrace.
advColon = Advance(Colon & atDepth & objSpan, 1) scanObjStartAnyToken = ScanTo(Advance(objStart, 1), anyToken)
errAfterColon = ScanTo(advColon, anyToken) & ~ (nested | (valueToken & atDepth)) errAfterLBrace = scanObjStartAnyToken & ~ (nested | valueToken | RBrace)
//
// Every Comma must be followed by a key string
advComma = Advance(Comma & atDepth & objSpan, 1)
errAfterComma = ScanTo(advComma, anyToken) & ~ strAtDepth
//
// After the LBrace we must have either a value or an RBrace.
scanObjStartAnyToken = ScanTo(Advance(objStart, 1), anyToken)
errAfterLBrace = scanObjStartAnyToken & ~ (nested | valueToken | RBrace)
``` ```
# CFG Kernel (_note: this doc isn't ready_) # CFG Kernel (_note: this doc isn't ready_)
......
Clone repository
  • Bracket Matching
  • CSV Validation
  • CSVediting
  • CSVparsing
  • Character Code Compilers
  • KernelLibrary
  • Pablo
  • ParabixTransform
  • Parallel Deletion
  • Parallel Hashing
  • Performance Testing Script
  • Shuffle Pattern Library
  • StaticCCC
  • String Insertion
  • UCD: Unicode Property Database and Compilers
View All Pages