mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2025-01-15 18:29:50 +00:00
token support for regular expression strings /.../ and \...\. Also tokenizer support for =~ and !~ operators.
This commit is contained in:
parent
6f2b59c4d6
commit
fdf33c69b7
15
error.h
15
error.h
@ -67,6 +67,21 @@ public:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class fsstring_error: public mpw_error {
|
||||||
|
public:
|
||||||
|
fsstring_error(int status = -3) :
|
||||||
|
mpw_error(status, "MPW Shell - /s must occur in pairs.")
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
class bsstring_error: public mpw_error {
|
||||||
|
public:
|
||||||
|
bsstring_error(int status = -3) :
|
||||||
|
mpw_error(status, "MPW Shell - \\s must occur in pairs.")
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
these are used for flow-control.
|
these are used for flow-control.
|
||||||
they do not inherit from std::exception to prevent being caught
|
they do not inherit from std::exception to prevent being caught
|
||||||
|
@ -37,6 +37,13 @@
|
|||||||
dchar = escape_seq | (any - escape - ["]);
|
dchar = escape_seq | (any - escape - ["]);
|
||||||
dstring = ["] dchar** ["] $err{ throw dstring_error(); } ;
|
dstring = ["] dchar** ["] $err{ throw dstring_error(); } ;
|
||||||
|
|
||||||
|
# search-forward string
|
||||||
|
fschar = escape_seq | (any - escape - [/]);
|
||||||
|
fsstring = [/] fschar** [/] $err{ throw fsstring_error(); } ;
|
||||||
|
|
||||||
|
# search-backward string
|
||||||
|
bschar = escape_seq | (any - escape - [\\]);
|
||||||
|
bsstring = [\\] bschar** [\\] $err{ throw bsstring_error(); } ;
|
||||||
|
|
||||||
action eval { eval }
|
action eval { eval }
|
||||||
|
|
||||||
@ -127,9 +134,16 @@
|
|||||||
'-=' when eval
|
'-=' when eval
|
||||||
%push_token => { tokens.emplace_back("-=", '-='); };
|
%push_token => { tokens.emplace_back("-=", '-='); };
|
||||||
|
|
||||||
|
'=~' when eval
|
||||||
|
%push_token => { tokens.emplace_back("=~", '=~'); };
|
||||||
|
|
||||||
|
'!~' when eval
|
||||||
|
%push_token => { tokens.emplace_back("!~", '!~'); };
|
||||||
|
|
||||||
sstring => push_string;
|
sstring => push_string;
|
||||||
dstring => push_string;
|
dstring => push_string;
|
||||||
|
fsstring => push_string;
|
||||||
|
bsstring => push_string;
|
||||||
escape_seq => push_string;
|
escape_seq => push_string;
|
||||||
|
|
||||||
char => push;
|
char => push;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user