MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / isNumber

Function isNumber

mini-code-edit/cm/mode/scheme/scheme.js:37–44  ·  view source on GitHub ↗

* Scheme numbers are complicated unfortunately. * Checks if we're looking at a number, which might be possibly a fraction. * Also checks that it is not part of a longer identifier. Returns true/false accordingly.

(ch, stream)

Source from the content-addressed store, hash-verified

35 * Also checks that it is not part of a longer identifier. Returns true/false accordingly.
36 */
37 function isNumber(ch, stream){
38 if (!stream.eatWhile(/[0-9]/)) {
39 if (stream.eat(/\//)) stream.eatWhile(/[0-9]/);
40 if (stream.eol() || !(/[a-zA-Z\-\_\/]/.test(stream.peek()))) return true;
41 stream.backUp(stream.current().length - 1); // undo all the eating
42 }
43 return false;
44 }
45
46 return {
47 startState: function () {

Callers 1

scheme.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected