Verified Commit 3ad486f5 authored by Camil Staps's avatar Camil Staps 🙂

v0.1.4: don't reset state on lines that only contain whitespace

parent 0e6dd916
...@@ -123,6 +123,7 @@ var highlightRules = { ...@@ -123,6 +123,7 @@ var highlightRules = {
[/(')([\w`]+)('\.)/, ['punctuation', 'qualified', 'punctuation']], [/(')([\w`]+)('\.)/, ['punctuation', 'qualified', 'punctuation']],
], ],
_append: [ _append: [
[/(\n\s*(?=\n))/, ['whitespace']],
[/(\n[^\n\S]*)/, function(matches, states) { [/(\n[^\n\S]*)/, function(matches, states) {
var whitespace = matches[1]; var whitespace = matches[1];
var rest = matches[2]; var rest = matches[2];
......
{ {
"name": "clean.js", "name": "clean.js",
"version": "0.1.3", "version": "0.1.4",
"description": "Clean language highlighter", "description": "Clean language highlighter",
"main": "clean.js", "main": "clean.js",
"dependencies": {}, "dependencies": {},
......
----- -----
:: Expression :: Expression = Var !BoundVar
= Var BoundVar | App !App
| App App | (@) infixl 9 !Expression ![Expression]
| (@) infixl 9 Expression [Expression] | Let !Let
| Case !Case
| Selection !SelectorKind !Expression ![Selection]
| Update !Expression ![Selection] Expression
| RecordUpdate !(Global DefinedSymbol) !Expression ![Bind Expression (Global FieldSymbol)]
| TupleSelect !DefinedSymbol !Int !Expression
| BasicExpr !BasicValue
| Conditional !Conditional
| AnyCodeExpr !(CodeBinding BoundVar) !(CodeBinding FreeVar) ![String]
| ABCCodeExpr ![String] !Bool
| MatchExpr !(Global DefinedSymbol) !Expression
| IsConstructor !Expression !(Global DefinedSymbol) /*arity*/!Int !GlobalIndex !Ident !Position
| FreeVar FreeVar
| DictionariesFunction ![(FreeVar,AType)] !Expression !AType
| Constant !SymbIdent !Int !Priority /* auxiliary clause used during checking */
| ClassVariable !VarInfoPtr /* auxiliary clause used during overloading */
| DynamicExpr !DynamicExpr
| TypeCodeExpression !TypeCodeExpression
| TypeSignature !(Int Int -> (AType,Int,Int)) !Expression
| EE
| NoBind ExprInfoPtr /* auxiliary, to store fields that are not specified in a record expression */
| FailExpr !Ident // only allowed on (case) root positions
| ExprToBeRemoved
----- -----
punctuation :: punctuation ::
whitespace whitespace
type Expression type Expression
whitespace \n whitespace
punctuation = punctuation =
whitespace whitespace
constructor Var constructor Var
whitespace whitespace
punctuation !
type BoundVar type BoundVar
whitespace \n whitespace \n
punctuation | punctuation |
whitespace whitespace
constructor App constructor App
whitespace whitespace
punctuation !
type App type App
whitespace \n whitespace \n
punctuation | punctuation |
whitespace whitespace
punctuation ( punctuation (
...@@ -29,9 +59,279 @@ whitespace ...@@ -29,9 +59,279 @@ whitespace
keyword infixl keyword infixl
whitespace whitespace
keyword 9 keyword 9
whitespace
punctuation !
type Expression
whitespace
punctuation ![
type Expression
punctuation ]
whitespace \n
punctuation |
whitespace
constructor Let
whitespace
punctuation !
type Let
whitespace \n
punctuation |
whitespace
constructor Case
whitespace
punctuation !
type Case
whitespace \n
punctuation |
whitespace
constructor Selection
whitespace
punctuation !
type SelectorKind
whitespace
punctuation !
type Expression
whitespace
punctuation ![
type Selection
punctuation ]
whitespace \n
punctuation |
whitespace
constructor Update
whitespace
punctuation !
type Expression
whitespace
punctuation ![
type Selection
punctuation ]
whitespace
type Expression
whitespace \n
punctuation |
whitespace
constructor RecordUpdate
whitespace
punctuation !(
type Global
whitespace
type DefinedSymbol
punctuation )
whitespace whitespace
punctuation !
type Expression type Expression
whitespace whitespace
punctuation [ punctuation ![
type Bind
whitespace
type Expression
whitespace
punctuation (
type Global
whitespace
type FieldSymbol
punctuation )]
whitespace \n
punctuation |
whitespace
constructor TupleSelect
whitespace
punctuation !
type DefinedSymbol
whitespace
punctuation !
type Int
whitespace
punctuation !
type Expression type Expression
whitespace \n
punctuation |
whitespace
constructor BasicExpr
whitespace
punctuation !
type BasicValue
whitespace \n
punctuation |
whitespace
constructor Conditional
whitespace
punctuation !
type Conditional
whitespace \n\n
punctuation |
whitespace
constructor AnyCodeExpr
whitespace
punctuation !(
type CodeBinding
whitespace
type BoundVar
punctuation )
whitespace
punctuation !(
type CodeBinding
whitespace
type FreeVar
punctuation )
whitespace
punctuation ![
type String
punctuation ] punctuation ]
whitespace \n
punctuation |
whitespace
constructor ABCCodeExpr
whitespace
punctuation ![
type String
punctuation ]
whitespace
punctuation !
type Bool
whitespace \n\n
punctuation |
whitespace
constructor MatchExpr
whitespace
punctuation !(
type Global
whitespace
type DefinedSymbol
punctuation )
whitespace
punctuation !
type Expression
whitespace \n
punctuation |
whitespace
constructor IsConstructor
whitespace
punctuation !
type Expression
whitespace
punctuation !(
type Global
whitespace
type DefinedSymbol
punctuation )
whitespace
comment /*arity*/
punctuation !
type Int
whitespace
punctuation !
type GlobalIndex
whitespace
punctuation !
type Ident
whitespace
punctuation !
type Position
whitespace \n
punctuation |
whitespace
constructor FreeVar
whitespace
type FreeVar
whitespace \n
punctuation |
whitespace
constructor DictionariesFunction
whitespace
punctuation ![(
type FreeVar
punctuation ,
type AType
punctuation )]
whitespace
punctuation !
type Expression
whitespace
punctuation !
type AType
whitespace \n\n
punctuation |
whitespace
constructor Constant
whitespace
punctuation !
type SymbIdent
whitespace
punctuation !
type Int
whitespace
punctuation !
type Priority
whitespace
comment /* auxiliary clause used during checking */
whitespace \n
punctuation |
whitespace
constructor ClassVariable
whitespace
punctuation !
type VarInfoPtr
whitespace
comment /* auxiliary clause used during overloading */
whitespace \n\n
punctuation |
whitespace
constructor DynamicExpr
whitespace
punctuation !
type DynamicExpr
whitespace \n
punctuation |
whitespace
constructor TypeCodeExpression
whitespace
punctuation !
type TypeCodeExpression
whitespace \n\n
punctuation |
whitespace
constructor TypeSignature
whitespace
punctuation !(
type Int
whitespace
type Int
whitespace
punctuation ->
whitespace
punctuation (
type AType
punctuation ,
type Int
punctuation ,
type Int
punctuation ))
whitespace
punctuation !
type Expression
whitespace \n\n
punctuation |
whitespace
constructor EE
whitespace \n
punctuation |
whitespace
constructor NoBind
whitespace
type ExprInfoPtr
whitespace
comment /* auxiliary, to store fields that are not specified in a record expression */
whitespace \n
punctuation |
whitespace
constructor FailExpr
whitespace
punctuation !
type Ident
whitespace
comment // only allowed on (case) root positions
whitespace \n
punctuation |
whitespace
constructor ExprToBeRemoved
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment