-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
comments only supported at the start of a line
- Loading branch information
Showing
8 changed files
with
53 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
nomnoml.css | ||
*.css | ||
webapp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
CodeMirror.defineMode('nomnoml', function() { | ||
return { | ||
startState: function() { return { inSymbol: false } }, | ||
token: function(stream, state) { | ||
if (stream.sol()){ | ||
stream.eatSpace() | ||
if (stream.peek() === '#'){ | ||
stream.skipToEnd() | ||
return 'meta' | ||
} | ||
if (stream.match('//')){ | ||
stream.skipToEnd() | ||
return 'comment' | ||
} | ||
CodeMirror.defineMode('nomnoml', () => ({ | ||
startState() { | ||
return {} | ||
}, | ||
token(stream, state) { | ||
if (stream.sol()) { | ||
stream.eatSpace() | ||
if (stream.peek() === '#') { | ||
stream.skipToEnd() | ||
return 'meta' | ||
} | ||
if (stream.match('//')) { | ||
stream.skipToEnd() | ||
return 'comment' | ||
} | ||
} | ||
|
||
var delimiters = '[]|'.split('') | ||
var operator = '>+-:;'.split('') | ||
var all = [].concat(delimiters, operator) | ||
var delimiters = '[]|;'.split('') | ||
var operator = '<>()+-:'.split('') | ||
var all = [...delimiters, ...operator] | ||
|
||
if (stream.peek() === '<'){ | ||
stream.eat('<') | ||
if (stream.skipTo('>')) { | ||
stream.eat('>') | ||
return 'keyword' | ||
} | ||
return null | ||
if (stream.peek() === '<') { | ||
stream.eat('<') | ||
if (stream.skipTo('>')) { | ||
stream.eat('>') | ||
return 'keyword' | ||
} | ||
|
||
if (delimiters.some(function (c){ return stream.eat(c) })) | ||
return 'bracket' | ||
if (operator.some(function (c){ return stream.eat(c) })) | ||
return 'operator' | ||
stream.eatWhile(function (c){ return all.indexOf(c) === -1 }) | ||
return null; | ||
return null | ||
} | ||
}; | ||
}); | ||
|
||
if (delimiters.some((c) => stream.eat(c))) return 'bracket' | ||
if (operator.some((c) => stream.eat(c))) return 'operator' | ||
stream.eatWhile((c) => all.indexOf(c) === -1) | ||
return null | ||
}, | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters