[parser] number regex refinements

This commit is contained in:
Timothy Stack 2013-06-14 18:41:31 -07:00
parent 3e54f1d8cc
commit 945495b5d1

View File

@ -93,9 +93,11 @@ static struct {
},
{ "pcnt", pcrepp("\\A(-?[0-9]+(\\.[0-9]+)?[ ]*%\\b)"),
},
{ "num", pcrepp("\\A(-?[0-9]+(\\.[0-9]+)?([eE][-+][0-9]+)?\\b)"),
{ "num", pcrepp("\\A(-?[0-9]+(\\.[0-9]+)?([eE][-+][0-9]+)?)"
"\\b(?![\\._\\-][a-zA-Z])"),
},
{ "hex", pcrepp("\\A(-?(?:0x|[0-9])[0-9a-fA-F]+\\b)"),
{ "hex", pcrepp("\\A(-?(?:0x|[0-9])[0-9a-fA-F]+)"
"\\b(?![\\._\\-][a-zA-Z])"),
},
{ "mail", pcrepp("\\A([a-zA-Z0-9\\._%+-]+@[a-zA-Z0-9\\.-]+\\.[a-zA-Z]+)\\b"), },
@ -103,7 +105,8 @@ static struct {
{ "word", pcrepp(
"\\A([a-zA-Z][a-z']+(?=[\\s\\(\\)!\\*:;'\\\"\\?,]|[\\.\\!,\\?]\\s|$))"), },
{ "sym", pcrepp(
"\\A([^\";\\s:=,\\(\\)\\{\\}\\[\\]\\+#!@%\\^&\\*'\\?<>\\~`\\|\\\\]+)"),
"\\A([^\";\\s:=,\\(\\)\\{\\}\\[\\]\\+#!@%\\^&\\*'\\?<>\\~`\\|\\\\]+"
"(?:::[^\";\\s:=,\\(\\)\\{\\}\\[\\]\\+#!@%\\^&\\*'\\?<>\\~`\\|\\\\]+)*)"),
},
{ "line", pcrepp("\\A(\r?\n|\r|;)"),
},