nodebox / seed

Procedural Content Generator
https://seed.emrg.be/
MIT License
22 stars 8 forks source link

Better "whitespace" checking. #21

Open stebanos opened 6 years ago

stebanos commented 6 years ago

Right now, as individual characters goes, only single spaces " " are considered white space, and we tell the parser to skip those in some instances (most importantly when they occur between {{ }} tokens). But sometimes white space is not visible to the eye, causing errors that are hard to spot. Extend the skipWhitespace function to characters that are also considered white space.

The alternative is to make such white space characters visible in the editor. For that, #19 is a prerequisite.

stebanos commented 6 years ago

I added a WHITESPACE character range in b0c1d1b, because some students had trouble with the ALT+SPACE character in the workshop. This range is not complete.

kunal-mohta commented 6 years ago

@stebanos What other characters would be needed to be added in the range?

stebanos commented 6 years ago

I think it's these: https://stackoverflow.com/questions/6073637/javascript-regex-whitespace-characters

charcodes: 9, 10, 11, 12, 13, 32, 160, 8232, 8233

Maybe there's more?

kunal-mohta commented 6 years ago

Okay so we got \t, \n, \v, \f, \r, " " for the first six ones. String.fromCharCode() gives " ", \u2028, \u2029 for the last three.