ylixir / phap

Php Has Another Parser
GNU Lesser General Public License v3.0
4 stars 1 forks source link

Utility functions #14

Closed ylixir closed 5 years ago

ylixir commented 5 years ago

consider adding some boilerplate parsers

things to consider are thing as simple as a decimal integer parser, and things as complex as a json parser

ylixir commented 5 years ago

let's just steal the functions provided by elm's parser for now. these include

  1. [x] int
  2. [x] float (don't forget exponential notation
  3. [x] hex
  4. [x] octal (optional)
  5. [x] binary (optional)
  6. ~keyword (require trailing whitespace)~
  7. [x] spaces (' ','\t')
  8. [x] end_of_line or('\r\n','\n','\r')
  9. [x] white_space (' ','\t','\n','\r')
  10. [x] block for comments and strings. needs start, end, and escape combinators. note that the escape combinator can be used for nesting
  11. ~line_comment pass it a parser that the comment starts with~

https://package.elm-lang.org/packages/elm/parser/latest/Parser

ylixir commented 5 years ago

when implementing this, i have discovered that much richer type expression is possible if we rearrange the order of arguments given to our fold application function.

this is a breaking change, so these features will need to be moved to version 0.5.0 instead of 0.4.1 as originally planned

ylixir commented 5 years ago

dropping the keyword functions, since it is too domain specific. it really matches whitespace languages only

ylixir commented 5 years ago

i'm not convinced that the line comment is a useful shortcut for block(start,eol,fail). we will leave it out for now

i'm a little worried about not having a recursive or nestable thing. i guess i will handle that if needed