nearley icon indicating copy to clipboard operation
nearley copied to clipboard

Number with commas

Open jnbbender opened this issue 4 years ago • 0 comments

I am using the standard Nearley definition of a Number (see below) but I don't know how Nearley supports ranges. i.e. digits{1,3}

Here's what I'm using for number

number -> 
           digits "." digits {% (data) => Number(data[0] + "." + data[2]) %}
// Trying to figure out digits{1,3} "," digits
       | digits {% (data) => Number(data.join("")) %}
		 
digits ->
         digit {% id %}
       | digit digits {% (data) => data.join("") %}
		   
digit -> [0-9] {% id %}

Thanks

jnbbender avatar Oct 27 '20 19:10 jnbbender