Permalink
Browse files

Perlito5 - TODO update

  • Loading branch information...
1 parent 20a5fc8 commit 25b8875bcef5a6a6ee77e6a43d107c9cc13ae46e @fglock committed Mar 15, 2012
Showing with 66 additions and 82 deletions.
  1. +5 −7 TODO-perlito5
  2. +19 −37 html/perlito5.js
  3. +18 −31 lib5/Perlito5/Grammar/String.pm
  4. +24 −7 src5/lib/Perlito5/Grammar/String.pm
View
12 TODO-perlito5
@@ -1,8 +1,8 @@
TODO list for Perlito5
-* Perlito5
+* perlito5 command-line
-- fix warning message after eval
+--
* basic functionality
@@ -35,13 +35,14 @@ TODO list for Perlito5
-- check that \(@a) and \@a have different meanings
--- double-quoted here-docs
-
-- parse "local $x[1]"
-- parse local $@
-- $v{x} doesn't autoquote the index
-- $v{x} doesn't interpolate inside double quotes
+-- deref inside double quotes:
+ $ node perlito5.js -Bjs -e ' my $x = "123"; my $y = \$x; print "[$$y]\n" '
+ [$[object Object]]
-- this should give a syntax error: $x->meth 123
@@ -64,9 +65,6 @@ TODO list for Perlito5
-- symbol variables like $] ${"main::\$"} $#_
-- check that @_, $_, $a, $b and other special variables are in the right context (lexical, global, package global)
--- do EXPR (do $filename)
--- eval EXPR (try/catch)
-
-- emit array/hash slices: @a[@x], @a{@x}
-- add alternate mro's
View
56 html/perlito5.js
@@ -7508,57 +7508,39 @@ var p5100 = NAMESPACE['main'];
((v_MATCH || (v_MATCH = new HashRef({})))._hash_['bool'] = (((function () {
var v_pos1 = null;
(v_pos1 = (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to']);
- return (or(or(or(or(((function () {
- return (and((and(('c' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
- var v_pos1 = null;
- (v_pos1 = (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to']);
- return (or(((function () {
- return (and(and(and((and(('[' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
- var v_m2 = null;
- (v_m2 = _call_(NAMESPACE["Perlito5::Grammar"], "digits", [v_str,(v_MATCH || (v_MATCH = new HashRef({})))._hash_['to']]));
- if ( bool((v_m2 || (v_m2 = new HashRef({})))._hash_['bool']) ) {
- ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (v_m2 || (v_m2 = new HashRef({})))._hash_['to']);
- ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['Perlito5::Grammar.digits'] = v_m2);
- return (1);
- }
-
- else {
- return (0);
- }
-})()); }), function () { return (and((']' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })); }), function () { return ((function () {
- ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([_call_((v_MATCH || (v_MATCH = new HashRef({})))._hash_['Perlito5::Grammar.digits'], "flat", [])]));
+ return (or(or(or(or(or(or(or(((function () {
+ return (and((and(('a' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
+ ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([7]));
return (1);
})()); }));
})()), function () { return ((function () {
((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = v_pos1);
- return ((and(((function () {
- var v_m2 = null;
- (v_m2 = _call_(NAMESPACE["Perlito5::Grammar"], "digits", [v_str,(v_MATCH || (v_MATCH = new HashRef({})))._hash_['to']]));
- if ( bool((v_m2 || (v_m2 = new HashRef({})))._hash_['bool']) ) {
- ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (v_m2 || (v_m2 = new HashRef({})))._hash_['to']);
- ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['Perlito5::Grammar.digits'] = v_m2);
- return (1);
- }
-
- else {
- return (0);
- }
-})()), function () { return ((function () {
- ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([_call_((v_MATCH || (v_MATCH = new HashRef({})))._hash_['Perlito5::Grammar.digits'], "flat", [])]));
+ return ((and((and(('b' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
+ ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([8]));
return (1);
})()); })));
-})()); }));
-})()); }));
-})()), function () { return ((function () {
+})()); }), function () { return ((function () {
((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = v_pos1);
return ((and((and(('e' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([27]));
return (1);
})()); })));
})()); }), function () { return ((function () {
((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = v_pos1);
+ return ((and((and(('f' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
+ ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([12]));
+ return (1);
+})()); })));
+})()); }), function () { return ((function () {
+ ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = v_pos1);
return ((and((and(('n' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
- ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = String.fromCharCode(10));
+ ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([10]));
+ return (1);
+})()); })));
+})()); }), function () { return ((function () {
+ ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = v_pos1);
+ return ((and((and(('r' == p5129.substr([v_str, (v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'], 1])), function () { return (((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'] = (1 + num((v_MATCH || (v_MATCH = new HashRef({})))._hash_['to'])))); })), function () { return ((function () {
+ ((v_MATCH || (v_MATCH = new HashRef({})))._hash_['capture'] = p5129.chr([13]));
return (1);
})()); })));
})()); }), function () { return ((function () {
View
49 lib5/Perlito5/Grammar/String.pm
@@ -834,56 +834,43 @@ sub Perlito5::Grammar::String::double_quoted_unescape {
((my $MATCH) = Perlito5::Match->new(('str' => $str), ('from' => $pos), ('to' => $pos), ('bool' => 1)));
($MATCH->{'bool'} = (((do {
((my $pos1) = $MATCH->{'to'});
- ((((((do {
- (((('c' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
- ((my $pos1) = $MATCH->{'to'});
- (((do {
- (((((('[' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
- ((my $m2) = Perlito5::Grammar->digits($str, $MATCH->{'to'}));
- if ($m2->{'bool'}) {
- ($MATCH->{'to'} = $m2->{'to'});
- ($MATCH->{'Perlito5::Grammar.digits'} = $m2);
- 1
- }
- else {
- 0
- }
-}))) && (((']' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'})))))) && ((do {
- ($MATCH->{'capture'} = chr($MATCH->{'Perlito5::Grammar.digits'}->flat()));
+ (((((((((do {
+ (((('a' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
+ ($MATCH->{'capture'} = chr(7));
1
})))
})) || ((do {
($MATCH->{'to'} = $pos1);
- ((((do {
- ((my $m2) = Perlito5::Grammar->digits($str, $MATCH->{'to'}));
- if ($m2->{'bool'}) {
- ($MATCH->{'to'} = $m2->{'to'});
- ($MATCH->{'Perlito5::Grammar.digits'} = $m2);
- 1
- }
- else {
- 0
- }
-})) && ((do {
- ($MATCH->{'capture'} = chr($MATCH->{'Perlito5::Grammar.digits'}->flat()));
+ ((((('b' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
+ ($MATCH->{'capture'} = chr(8));
1
}))))
-})))
-})))
-})) || ((do {
+}))) || ((do {
($MATCH->{'to'} = $pos1);
((((('e' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
($MATCH->{'capture'} = chr(27));
1
}))))
}))) || ((do {
($MATCH->{'to'} = $pos1);
+ ((((('f' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
+ ($MATCH->{'capture'} = chr(12));
+ 1
+}))))
+}))) || ((do {
+ ($MATCH->{'to'} = $pos1);
((((('n' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
($MATCH->{'capture'} = chr(10));
1
}))))
}))) || ((do {
($MATCH->{'to'} = $pos1);
+ ((((('r' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
+ ($MATCH->{'capture'} = chr(13));
+ 1
+}))))
+}))) || ((do {
+ ($MATCH->{'to'} = $pos1);
((((('t' eq substr($str, $MATCH->{'to'}, 1)) && (($MATCH->{'to'} = (1 + $MATCH->{'to'}))))) && ((do {
($MATCH->{'capture'} = chr(9));
1
View
31 src5/lib/Perlito5/Grammar/String.pm
@@ -427,16 +427,33 @@ token single_quoted_unescape {
};
token double_quoted_unescape {
- | c
- [ \[ <Perlito5::Grammar.digits> \]
- { $MATCH->{"capture"} = chr( $MATCH->{"Perlito5::Grammar.digits"}->flat() ) }
- | <Perlito5::Grammar.digits>
- { $MATCH->{"capture"} = chr( $MATCH->{"Perlito5::Grammar.digits"}->flat() ) }
- ]
+
+ # TODO - "\"+octal "\x"+hex - initial zero is optional; max 3 digit octal (377); max 2 digit hex
+ # TODO - \cC = Control-C
+ # TODO - \N{charname} - requires "use charnames"
+ # TODO - \x{03a3} - unicode hex
+ # TODO - \L \Q \U ... \E - lowercase/uppercase/quote until /E
+ # TODO - \l \u - uppercase next char
+
+ ## | c
+ ## [ \[ <Perlito5::Grammar.digits> \]
+ ## { $MATCH->{"capture"} = chr( $MATCH->{"Perlito5::Grammar.digits"}->flat() ) }
+ ## | <Perlito5::Grammar.digits>
+ ## { $MATCH->{"capture"} = chr( $MATCH->{"Perlito5::Grammar.digits"}->flat() ) }
+ ## ]
+
+ | a
+ { $MATCH->{"capture"} = chr(7) }
+ | b
+ { $MATCH->{"capture"} = chr(8) }
| e
{ $MATCH->{"capture"} = chr(27) }
+ | f
+ { $MATCH->{"capture"} = chr(12) }
| n
- { $MATCH->{"capture"} = "\n" }
+ { $MATCH->{"capture"} = chr(10) }
+ | r
+ { $MATCH->{"capture"} = chr(13) }
| t
{ $MATCH->{"capture"} = chr(9) }
| <char_any>

0 comments on commit 25b8875

Please sign in to comment.