Skip to content

Latest commit

 

History

History
160 lines (130 loc) · 4.04 KB

TODO.md

File metadata and controls

160 lines (130 loc) · 4.04 KB

TODO

  • Source maps for generated parsers.
    • Newlines get skipped in function output, messing up source maps
  • BUG: $0 is undefined in structural mapping
  • BUG: String values are extra escaped in mapping
InsertNewlineLiteral
  # Gets inserted as "\\n"
  "" -> "\n"

InsertNewlineJS
  # Gets inserted correctly as "\n"
  "" ->
    return "\n"
  • Explore rules that are higher order functions
NestedItems(X)
  PushIndent NestedItem(X)*:items PopIndent:indent -> [indent, items]

NestedItem(X)
  $Nested X &EOS
  • Explore drop prefix (?: maybe, or :, -). Items match as normal but are dropped from the sequence's handler.
    Rule
      -A B -C
    
  • Registering CoffeeCoverage is slow in the current config (was a VSCode / WSL misconfiguration)
  • Explore getting byte arrays, length then bytes (MIDI, etc.)
  • Define literal code to be included in parser.
  • Automatic parse tree generator. Generate nodes with type, location, and value.
  • Automatic syntax highlighter generation for VSCode.
  • Restore tokenize parser option to return token tree with location data
  • Prevent identifiers from using JS reserved words
  • Structural mapping
    • top level undefined -> undefined
    • Object fields shorthand -> {x, y}
    • Multi-line objects and arrays
    • to object -> {}
    • Negative numbers, floats, null, and false in bare structural mappings
  • Add import so grammars can import rules from sub-grammars. (Maybe superceded by literal code block)
  • Add undefined rule error in vscode extension
  • Test regex mapping to named parameters
  • Named parameters
  • Programatically skip rules
  • Empty mapping -> []
  • Handle object structure including nesting.
  • Restore Coverage data
    • Hybrid Coffee + TypeScript coverage using babel
  • Testing
    • 100% Coverage
    • Run benchmark separate from tests with non-instrumented code
    • Reconcile source-map-support and CoffeeScript both patching prepareStackTrace
  • esbuild
    • Browser build
      • need to merge in fs.readFileSync machine.ts and machine.js contents
    • Build cli bin file
    • Node dist
    • Test parse -> compile -> parse round trip
    • emit sourcemaps
    • emit types
  • Hera esbuild-plugin
  • Split out decompile to util
  • Decompile regexes to character class expressions when possible.
  • Languages
    • Compile to TypeScript
    • Compile to JavaScript
    • Compile to Go
  • Display regexp properly in $EXPECT
  • Handle nested array structures
  • Change structural handlers to use $1, $2 rather than 1, 2, etc. so that number literals can be part of the result.
    • Update VSCode Extension
      • Fix $ token at start of line not coloring properly
      • Update to latest Hera
  • Remove _ as a rule name because golang doesn't like it
  • Switch to rules.json

TODO but too vague

  • Compile to optimized regexes by aggregating grammar nodes into fewer regexps where possible.
  • Type annotation for grammar rules
  • Aggregate errors and warnings

Features

. EOF : Any Character and EOF regexes. EOF could also be a special rule implemented as pos == input.length

any = /[^]/
EOF = /(?![^])/y // must be sticky mode

Quantifiers

{n}, {n,}, {n,m}, {,m}

Implement quantifiers and unify with ?,+,* implementations.


CLI

Create a hera cli to build parsers.


Bare Regexes - Added!

Allow for "bare" character classes to make regexes.

Rule
  [a-z]+[1-9]*

Flags
  [dgimsuy]

Quants
  [0-9]{3,4}

Named variables - Added!

Grammar
  Preamble:pre Files+:files Suffix:s

Phone
  # Also allow named groups in regexes
  /1-?(<area>[0-9]{3})-?(<number>[0-9]{3}-?[0-9]{4})/ ->
    return {
      area,
      numeber: number.replace(/[^0-9]/, "")
    }

i insensitive flag that can be added to RegExps, strings, and character classes

Name
  [_a-z0-9]+i

Id
  /cool|rad|dad/i

InsensitiveString
  "a fun game"i