cvsuser 05/02/19 03:33:20
Modified: languages/m4 ChangeLog
languages/m4/src builtin.imc freeze.imc input.imc macro.imc
output.imc
languages/m4/t/regex 002_tokens.t
Log:
Use '.param pmc' instead of '.param Hash',
as there is no type checking.
Add some, yet unused, tests for PGE.
Revision Changes Path
1.10 +5 -1 parrot/languages/m4/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/public/parrot/languages/m4/ChangeLog,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ChangeLog 19 Feb 2005 10:57:23 -0000 1.9
+++ ChangeLog 19 Feb 2005 11:33:19 -0000 1.10
@@no-spam -1,4 +1,8 @@no-spam
-# $Id: ChangeLog,v 1.9 2005/02/19 10:57:23 bernhard Exp $
+# $Id: ChangeLog,v 1.10 2005/02/19 11:33:19 bernhard Exp $
+
+2005-02-19 Bernhard Schmalhofer
+ * Use '.param pmc' instead of '.param Hash', no type checking
+ * Add some, yet unused, tests for PGE
2005-01-29 Bernhard Schmalhofer
* yank it up to revision 0.0.11
1.11 +24 -25 parrot/languages/m4/src/builtin.imc
Index: builtin.imc
===================================================================
RCS file: /cvs/public/parrot/languages/m4/src/builtin.imc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- builtin.imc 19 Feb 2005 10:57:26 -0000 1.10
+++ builtin.imc 19 Feb 2005 11:33:19 -0000 1.11
@@no-spam -1,4 +1,4 @@no-spam
-# $Id: builtin.imc,v 1.10 2005/02/19 10:57:26 bernhard Exp $
+# $Id: builtin.imc,v 1.11 2005/02/19 11:33:19 bernhard Exp $
=head1 NAME
@@no-spam -7,7 +7,7 @@no-spam
=head2 DESCRIPTION
Copyright: 2004 Bernhard Schmalhofer. All Rights Reserved.
-CVS Info: $Id: builtin.imc,v 1.10 2005/02/19 10:57:26 bernhard Exp $
+CVS Info: $Id: builtin.imc,v 1.11 2005/02/19 11:33:19 bernhard Exp $
History: Ported from GNU m4 1.4
References: http://www.gnu.org/software/m4/m4.html
@@no-spam -28,7 +28,7 @@no-spam
=cut
.sub builtin_tab_init
- .param Hash state
+ .param pmc state
.local pmc builtin_tab, builtin, func
@@no-spam -364,7 +364,7 @@no-spam
=cut
.sub builtin_init
- .param Hash state
+ .param pmc state
.local pmc iterator, builtin, builtin_tab
.local string name
@@no-spam -394,9 +394,9 @@no-spam
=cut
.sub define_builtin
- .param Hash state
+ .param pmc state
.param string name
- .param Hash builtin
+ .param pmc builtin
.local pmc symtab
symtab = state['symtab']
@@no-spam -431,7 +431,7 @@no-spam
=cut
.sub define_user_macro
- .param Hash state
+ .param pmc state
.param string name
.param string text
@@no-spam -459,7 +459,7 @@no-spam
=cut
.sub define_macro
- .param Hash state
+ .param pmc state
.param string name
.param string text
@@no-spam -477,7 +477,7 @@no-spam
=cut
.sub m4___file__
- .param Hash state
+ .param pmc state
.local string current_file
current_file = state['current_file']
@@no-spam -493,7 +493,7 @@no-spam
=cut
.sub m4_decr
- .param Hash state
+ .param pmc state
.param pmc arguments
.local int arg0
@@no-spam -516,7 +516,7 @@no-spam
=cut
.sub m4_define
- .param Hash state
+ .param pmc state
.param pmc arguments
# right now we handle only TOKEN_TEXT
@@no-spam -539,7 +539,7 @@no-spam
=cut
.sub m4_errprint
- .param Hash state
+ .param pmc state
.param pmc arguments
# right now we handle only TOKEN_TEXT
@@no-spam -573,7 +573,7 @@no-spam
=cut
.sub m4_eval
- .param Hash state
+ .param pmc state
.param pmc arguments
# get compiler
@@no-spam -601,7 +601,7 @@no-spam
=cut
.sub m4_format
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string arg0
@@no-spam -621,7 +621,7 @@no-spam
=cut
.sub m4_ifdef
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string arg0
@@no-spam -653,7 +653,7 @@no-spam
=cut
.sub m4_ifelse
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string ret
@@no-spam -689,7 +689,7 @@no-spam
=cut
.sub m4_incr
- .param Hash state
+ .param pmc state
.param pmc arguments
.local int arg0
@@no-spam -711,7 +711,7 @@no-spam
=cut
.sub m4_index
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string arg0, arg1
@@no-spam -736,7 +736,7 @@no-spam
=cut
.sub m4_len
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string arg0
@@no-spam -762,8 +762,7 @@no-spam
=cut
.sub m4_substr
-
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string ret
@@no-spam -800,7 +799,7 @@no-spam
=cut
.sub m4_syscmd
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string arg0
@@no-spam -829,7 +828,7 @@no-spam
=cut
.sub m4_sysval
- .param Hash state
+ .param pmc state
.param pmc arguments
# Retrieve it as a global set by m4_sysval
@@no-spam -850,7 +849,7 @@no-spam
=cut
.sub m4_undefine
- .param Hash state
+ .param pmc state
.param pmc arguments
.local string arg0
@@no-spam -872,7 +871,7 @@no-spam
=cut
.sub m4_not_implemented
- .param Hash state
+ .param pmc state
.param pmc arguments
.return ( 'not implemented yet' )
1.7 +4 -4 parrot/languages/m4/src/freeze.imc
Index: freeze.imc
===================================================================
RCS file: /cvs/public/parrot/languages/m4/src/freeze.imc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- freeze.imc 19 Feb 2005 10:57:26 -0000 1.6
+++ freeze.imc 19 Feb 2005 11:33:19 -0000 1.7
@@no-spam -1,4 +1,4 @@no-spam
-# $Id: freeze.imc,v 1.6 2005/02/19 10:57:26 bernhard Exp $
+# $Id: freeze.imc,v 1.7 2005/02/19 11:33:19 bernhard Exp $
=head1 NAME
@@no-spam -7,7 +7,7 @@no-spam
=head1 DESCRIPTION
Copyright: 2004 Bernhard Schmalhofer. All Rights Reserved.
-CVS Info: $Id: freeze.imc,v 1.6 2005/02/19 10:57:26 bernhard Exp $
+CVS Info: $Id: freeze.imc,v 1.7 2005/02/19 11:33:19 bernhard Exp $
History: Ported from GNU m4 1.4
References: http://www.gnu.org/software/m4/m4.html
@@no-spam -28,7 +28,7 @@no-spam
=cut
.sub produce_frozen_state
- .param Hash state
+ .param pmc state
.param string frozen_file
.local pmc symtab
@@no-spam -79,7 +79,7 @@no-spam
=cut
.sub reload_frozen_state
- .param Hash state
+ .param pmc state
.param string frozen_file
# Read the file into the string file
1.10 +5 -5 parrot/languages/m4/src/input.imc
Index: input.imc
===================================================================
RCS file: /cvs/public/parrot/languages/m4/src/input.imc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- input.imc 19 Feb 2005 10:57:26 -0000 1.9
+++ input.imc 19 Feb 2005 11:33:19 -0000 1.10
@@no-spam -1,4 +1,4 @@no-spam
-# $Id: input.imc,v 1.9 2005/02/19 10:57:26 bernhard Exp $
+# $Id: input.imc,v 1.10 2005/02/19 11:33:19 bernhard Exp $
=head1 NAME
@@no-spam -7,7 +7,7 @@no-spam
=head1 DESCRIPTION
Copyright: 2004 Bernhard Schmalhofer. All Rights Reserved.
-CVS Info: $Id: input.imc,v 1.9 2005/02/19 10:57:26 bernhard Exp $
+CVS Info: $Id: input.imc,v 1.10 2005/02/19 11:33:19 bernhard Exp $
History: Ported from GNU m4 1.4
References: http://www.gnu.org/software/m4/m4.html
@@no-spam -30,7 +30,7 @@no-spam
.include "datatypes.pasm"
.sub input_init
- .param Hash state
+ .param pmc state
.local pmc empty_array
@@no-spam -103,7 +103,7 @@no-spam
=cut
.sub push_file
- .param Hash state
+ .param pmc state
.param string filename
# This is needed for m4___file__
@@no-spam -160,7 +160,7 @@no-spam
=cut
.sub next_token
- .param Hash state
+ .param pmc state
.local pmc input_stack
input_stack = state['input_stack']
1.8 +7 -7 parrot/languages/m4/src/macro.imc
Index: macro.imc
===================================================================
RCS file: /cvs/public/parrot/languages/m4/src/macro.imc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- macro.imc 19 Feb 2005 10:57:26 -0000 1.7
+++ macro.imc 19 Feb 2005 11:33:19 -0000 1.8
@@no-spam -1,4 +1,4 @@no-spam
-# $Id: macro.imc,v 1.7 2005/02/19 10:57:26 bernhard Exp $
+# $Id: macro.imc,v 1.8 2005/02/19 11:33:19 bernhard Exp $
=head1 NAME
@@no-spam -7,7 +7,7 @@no-spam
=head1 DESCRIPTION
Copyright: 2004 Bernhard Schmalhofer. All Rights Reserved.
-CVS Info: $Id: macro.imc,v 1.7 2005/02/19 10:57:26 bernhard Exp $
+CVS Info: $Id: macro.imc,v 1.8 2005/02/19 11:33:19 bernhard Exp $
History: Ported from GNU m4 1.4
References: http://www.gnu.org/software/m4/m4.html
@@no-spam -21,7 +21,7 @@no-spam
=cut
.sub expand_input
- .param Hash state
+ .param pmc state
.local string token_data, token_type # current token data and type
@@no-spam -45,7 +45,7 @@no-spam
=cut
.sub expand_token
- .param Hash state
+ .param pmc state
.param string token_type
.param string token_data
@@no-spam -115,8 +115,8 @@no-spam
=cut
.sub expand_macro
- .param Hash state
- .param Hash symbol
+ .param pmc state
+ .param pmc symbol
.local int expansion_level
expansion_level = state['expansion_level']
@@no-spam -158,7 +158,7 @@no-spam
=cut
.sub call_macro
- .param Hash state
+ .param pmc state
.param pmc symbol
.param pmc arguments
1.6 +3 -3 parrot/languages/m4/src/output.imc
Index: output.imc
===================================================================
RCS file: /cvs/public/parrot/languages/m4/src/output.imc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- output.imc 19 Feb 2005 10:57:26 -0000 1.5
+++ output.imc 19 Feb 2005 11:33:19 -0000 1.6
@@no-spam -1,4 +1,4 @@no-spam
-# $Id: output.imc,v 1.5 2005/02/19 10:57:26 bernhard Exp $
+# $Id: output.imc,v 1.6 2005/02/19 11:33:19 bernhard Exp $
=head1 NAME
@@no-spam -7,7 +7,7 @@no-spam
=head1 DESCRIPTION
Copyright: 2004 Bernhard Schmalhofer. All Rights Reserved.
-CVS Info: $Id: output.imc,v 1.5 2005/02/19 10:57:26 bernhard Exp $
+CVS Info: $Id: output.imc,v 1.6 2005/02/19 11:33:19 bernhard Exp $
Overview: output
History: Ported from GNU m4 1.4
References: http://www.gnu.org/software/m4/m4.html
@@no-spam -23,7 +23,7 @@no-spam
=cut
.sub shipout_text
- .param Hash state
+ .param pmc state
.param string text
print text
1.5 +36 -1 parrot/languages/m4/t/regex/002_tokens.t
Index: 002_tokens.t
===================================================================
RCS file: /cvs/public/parrot/languages/m4/t/regex/002_tokens.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- 002_tokens.t 19 Feb 2005 10:57:28 -0000 1.4
+++ 002_tokens.t 19 Feb 2005 11:33:20 -0000 1.5
@@no-spam -1,10 +1,13 @@no-spam
-# $Id: 002_tokens.t,v 1.4 2005/02/19 10:57:28 bernhard Exp $
+# $Id: 002_tokens.t,v 1.5 2005/02/19 11:33:20 bernhard Exp $
use strict;
use Parrot::Test tests => 5;
use Parrot::Test::PGE;
+#p6rule_is ($str, '^abc', 'BOS abc');
+#p6rule_isnt($str, '^bc', 'BOS bc');
+#p6rule_like('zzzabcdefzzz', '(a.)..(..)', qr/1: <ab @no-spam 3>/, 'basic $1');
# Assemble PIR for simple pattern matching
sub get_pir_pcre
{
@@no-spam -198,6 +201,38 @@no-spam
OUTPUT
}
+# Do not use PGE yet
+if ( 0 )
+{
+my %regex = ( word => q{^(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z)(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9)*},
+ quoted_string => q{^`[^`]*'},
+ simple => q{^[^`#_a-zA-Z]},
+ comment => q{^#[^\n]*\n},
+ );
+# Test wether words are recognised
+{
+ foreach my $target ( q{foo}, q{_tmp}, q{name} )
+ {
+ p6rule_is( $target, $regex{word}, "'$target' is a word" );
+ }
+}
+
+# TODO: Test wether non-words are not recognised
+
+# Test wether quoted strings are recognised
+{
+ foreach my $target ( q{`quoted'}, q{`'} )
+ {
+ my $code = get_pir_pge( $target, 'quoted_string' );
+ pir_output_is( $code, << "OUTPUT", "'$target' is a quoted string" );
+
+1 match(es):
+$target
+OUTPUT
+ }
+}
+}
+
# TODO: Test wether non-quoted are not recognised
# TODO: Test wether comments are recognised