lexer: made REGEX more accurate

This commit is contained in:
satyr 2010-10-10 07:32:49 +09:00
parent b0e34edf99
commit 24a0015148
2 changed files with 5 additions and 5 deletions

View File

@ -605,7 +605,7 @@
MULTI_DENT = /^(?:\n[ \t]*)+/;
SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/;
JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/;
REGEX = /^\/(?!\s)(?:[^[\/\n\\]+|\\.|\[([^\\\]]+|\\.)*])+\/[imgy]{0,4}(?![A-Za-z])/;
REGEX = /^\/(?!\s)(?:[^[\/\n\\]+|\\[\s\S]|\[([^\]\n\\]+|\\[\s\S])*])+\/[imgy]{0,4}(?![A-Za-z])/;
HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?![A-Za-z])/;
HEREGEX_OMIT = /\s+(?:#.*)?/g;
MULTILINER = /\n/g;

View File

@ -557,10 +557,10 @@ JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/
# Regex-matching-regexes.
REGEX = /// ^
/ (?!\s) # disallow leading whitespace
(?: [^ [ / \n \\ ]+ # every other thing
| \\. # anything escaped
| \[ ( [^\\\]]+ | \\. )* ] # character class
/ (?!\s) # disallow leading whitespace
(?: [^ [ / \n \\ ]+ # every other thing
| \\[\s\S] # anything escaped
| \[ ( [^ \] \n \\ ]+ | \\[\s\S] )* ] # character class
)+
/ [imgy]{0,4} (?![A-Za-z])
///