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

Function isNumber

mini-code-edit/cm/mode/clojure/clojure.js:65–98  ·  view source on GitHub ↗
(ch, stream)

Source from the content-addressed store, hash-verified

63 }
64
65 function isNumber(ch, stream){
66 // hex
67 if ( ch === '0' && 'x' == stream.peek().toLowerCase() ) {
68 stream.eat('x');
69 stream.eatWhile(tests.hex);
70 return true;
71 }
72
73 // leading sign
74 if ( ch == '+' || ch == '-' ) {
75 stream.eat(tests.sign);
76 ch = stream.next();
77 }
78
79 if ( tests.digit.test(ch) ) {
80 stream.eat(ch);
81 stream.eatWhile(tests.digit);
82
83 if ( '.' == stream.peek() ) {
84 stream.eat('.');
85 stream.eatWhile(tests.digit);
86 }
87
88 if ( 'e' == stream.peek().toLowerCase() ) {
89 stream.eat(tests.exponent);
90 stream.eat(tests.sign);
91 stream.eatWhile(tests.digit);
92 }
93
94 return true;
95 }
96
97 return false;
98 }
99
100 return {
101 startState: function () {

Callers 1

clojure.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected