|
|
|
|
|
|
Synopsis |
|
|
|
|
Data types, classes and instances
|
|
|
Instances of Strokable are datatypes which can be syntax highlighted.
| | Methods | | | Instances | |
|
|
|
Instances of Failable can represent failure. This is a useful class for
future work, since then we can make stroking much easier.
| | Methods | | | Instances | |
|
|
|
|
|
|
|
|
|
Constructors | | Instances | |
|
|
|
Constructors | Parameters t (BList t) t | | ParErr t | |
| Instances | |
|
|
|
Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
|
Represents either a variable name or a variable name assigned to an
expression. AssBeg is a variable name maybe followed by an assignment.
AssRst is an equals sign and an expression. (AssBeg x (Just (AssRst
'=' '5'))) means x = 5.
| Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
|
Constructors | KeyValue t t (Expr t) | | KeyValueErr t | |
| Instances | |
|
|
Helper functions.
|
|
|
Normal stroker.
|
|
|
Error stroker.
|
|
|
|
|
Given a new style and a stroke, return a stroke with the new style appended
to the old one.
|
|
Stroking functions
|
|
|
Given a list of tokens to check for errors (xs) and a list of tokens to
stroke (xs'), returns normal strokes for xs' if there were no errors.
Otherwise returns error strokes for xs'.
|
|
|
Given a list of TT, if any of them is an error, returns an error stroker,
otherwise a normal stroker. Using e.g. existentials, we could make this
more general and have support for heterogeneous lists of elements which
implement Failable, but I haven't had the time to fix this.
|
|
|
Given a TT, return a Stroke for it.
|
|
|
The main stroking function.
|
|
The parser
|
|
|
Main parser.
|
|
|
Parser for statements such as return, while, do-while, for, etc.
|
|
|
Parser for blocks, i.e. a bunch of statements wrapped in curly brackets
or just a single statement.
Note that this works for JavaScript 1.8 lambda style function bodies as
well, e.g. function hello() 5, since expressions are also statements and
we don't require a trailing semi-colon.
TODO: function hello() var x; is not a valid program.
|
|
|
Parser for expressions which may be statements. In reality, any expression
is also a valid statement, but this is a slight compromise to get rid of
the massive performance loss which is introduced when allowing JavaScript
objects to be valid statements.
|
|
|
The basic idea here is to parse the rest of expressions, e.g. + 3 in x
+ 3 or [i] in x[i]. Anything which is useful in such a scenario goes
here. TODO: This accepts [], but shouldn't, since x[] is invalid.
|
|
|
Parser for expressions.
|
|
|
Parses both empty and non-empty arrays. Should probably be split up into
further parts to allow for the separation of [] and [1, 2, 3].
|
|
Parsing helpers
|
|
|
Parses a semicolon if it's there.
|
|
|
Parses a comma-separated list of valid identifiers.
|
|
|
|
Simple parsers
|
|
|
Parses a comment.
|
|
|
Parses a prefix operator.
|
|
|
Parses a infix operator.
|
|
|
Parses a postfix operator.
|
|
|
Parses any literal.
|
|
|
Parses any literal.
|
|
|
Parses any string.
|
|
|
Parses any valid number.
|
|
|
Parses any valid identifier.
|
|
|
Parses any boolean.
|
|
|
Parses a reserved word.
|
|
|
Parses a special token.
|
|
|
Parses an operator.
|
|
Recovery parsers
|
|
|
Expects a token x, recovers with errorToken.
|
|
|
Expects a special token.
|
|
|
Expects an expression.
|
|
|
|
|
General recovery parser, inserts an error token.
|
|
|
Weighted recovery.
|
|
Utility stuff
|
|
|
|
|
|
|
|
|
|
|
Better name for tokFromT.
|
|
|
Better name for tokT.
|
|
Produced by Haddock version 2.6.1 |