mirror of
https://github.com/tweag/nickel.git
synced 2024-09-20 08:05:15 +03:00
Implement the Ident contract
This commit is contained in:
parent
be8ce6f49e
commit
64312104ce
@ -33,9 +33,12 @@
|
||||
%blame% (%tag% "not a string" l);
|
||||
|
||||
Ident = fun l s =>
|
||||
let pattern = m#"_?[a-zA-Z][_a-zA-Z0-9]*"#m in
|
||||
if %isStr% s then
|
||||
//use regex here
|
||||
if (%strMatch% s pattern).index > -1 then
|
||||
s
|
||||
else
|
||||
%blame% (%tag% "invalid enum tag" l)
|
||||
else
|
||||
%blame% (%tag% "not a string" l);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user