Author: bernhard
Date: Sat May 12 04:09:18 2007
New Revision: 18514

Modified:
   trunk/languages/lisp/CHANGES
   trunk/languages/lisp/cl.pir
   trunk/languages/lisp/eval.pir
   trunk/languages/lisp/include/macros/standard.pir
   trunk/languages/lisp/include/macros/types.pir
   trunk/languages/lisp/internals.pir
   trunk/languages/lisp/lisp.pir
   trunk/languages/lisp/read.pir
   trunk/languages/lisp/validate.pir

Log:
#42885: Resurrect languages/lisp
Make it compile again, but not work, in a brutal way.
- Comment out removed opcodes
- Use the .return() syntax
- Start to use PGE for string matching
Old code is not removed, but marked with "VALID_IN_PARROT_0_2_0"


Modified: trunk/languages/lisp/CHANGES
==============================================================================
--- trunk/languages/lisp/CHANGES        (original)
+++ trunk/languages/lisp/CHANGES        Sat May 12 04:09:18 2007
@@ -1,3 +1,6 @@
+Changes for version 0.4.12
+--------------------------
+  * Make languages/lisp compile again, as it was broken due to changes in 
Parrot
 
 Changes for version 0.1.2
 -------------------------

Modified: trunk/languages/lisp/cl.pir
==============================================================================
--- trunk/languages/lisp/cl.pir (original)
+++ trunk/languages/lisp/cl.pir Sat May 12 04:09:18 2007
@@ -161,11 +161,12 @@
    goto DONE
 
 DONE:
-   argcI = 0                                   # No integer values returned
-   argcN = 0                                   # No float values returned
-   argcS = 0                                   # No string values returned
+   # VALID_IN_PARROT_0_2_0 argcI = 0                                   # No 
integer values returned
+   # VALID_IN_PARROT_0_2_0 argcN = 0                                   # No 
float values returned
+   # VALID_IN_PARROT_0_2_0 argcS = 0                                   # No 
string values returned
 
-   returncc                                    # Call the return continuation
+   # VALID_IN_PARROT_0_2_0 returncc                                    # Call 
the return continuation
+   .return()                                   # Call the return continuation
 .end
 
 .sub _atom
@@ -602,7 +603,7 @@
   .local int nvar
   .local int i
 
-   new_pad -1                                  # Create new lexical scope
+   # VALID_IN_PARROT_0_2_0 new_pad -1                                  # 
Create new lexical scope
 
   .ASSERT_MINIMUM_LENGTH(args, 1, ERROR_NARGS)
 
@@ -640,7 +641,8 @@
   .CAR(form, lptr)                             # Get the next init form
 
   .ASSERT_TYPE_AND_BRANCH(form, "list", ERROR_BAD_SPEC)
-  .ASSERT_LENGTH(form, 2, ERROR_BADSPEC)       # Ensure a valid init form
+  # VALID_IN_PARROT_0_2_0 .ASSERT_LENGTH(form, 2, ERROR_BADSPEC)       # 
Ensure a valid init form
+  .ASSERT_LENGTH(form, 2, ERROR_BAD_SPEC)      # Ensure a valid init form
 
   .CAR(symbol, form)                           # The symbol we're assigning to
   .SECOND(value, form)                         # The value being assigned
@@ -720,7 +722,7 @@
    goto CLEANUP                                        # and clean up before 
rethrow
 
 CLEANUP:
-   pop_pad                                     # Pop off the lexical scope
+   # VALID_IN_PARROT_0_2_0    pop_pad                                  # Pop 
off the lexical scope
 
    nvar = dynvars
    i = 0
@@ -747,7 +749,8 @@
    goto DONE
 
 
-ERROR_BADSPEC:
+# VALID_IN_PARROT_0_2_0 ERROR_BADSPEC:
+ERROR_BAD_SPEC:
   .ERROR_1("program-error", "illegal variable specification %s", form)
    goto CLEANUP
 
@@ -1100,14 +1103,15 @@
    goto DONE
 
 DONE:
-   is_prototyped = 0                           # Set up return registers
+   # VALID_IN_PARROT_0_2_0  is_prototyped = 0                          # Set 
up return registers
 
-   argcI = 0
-   argcN = 0
-   argcP = llen
-   argcS = 0
+   # VALID_IN_PARROT_0_2_0  argcI = 0
+   # VALID_IN_PARROT_0_2_0  argcN = 0
+   # VALID_IN_PARROT_0_2_0  argcP = llen
+   # VALID_IN_PARROT_0_2_0  argcS = 0
 
-   returncc
+   # VALID_IN_PARROT_0_2_0 returncc
+   .return()
 .end
 
 .sub _add

Modified: trunk/languages/lisp/eval.pir
==============================================================================
--- trunk/languages/lisp/eval.pir       (original)
+++ trunk/languages/lisp/eval.pir       Sat May 12 04:09:18 2007
@@ -72,15 +72,18 @@
 
 FUNCTION_CALL:
   _FUNCTION_CALL(function,funcargs)
-  goto DONE
+  # VALID_IN_PARROT_0_2_0 goto DONE
+  .return(retv)
 
 FUNCTION_NOT_FOUND:
   .ERROR_1("undefined-function", "%s is not a function name", symbol)
-  goto DONE
+  # VALID_IN_PARROT_0_2_0 goto DONE
+  .return(retv)
 
 ERROR_NARGS:
   .ERROR_0("program-error", "wrong number of arguments to EVAL")
-  goto DONE
+  # VALID_IN_PARROT_0_2_0 goto DONE
+  .return(retv)
 
 SPECIAL_FORMS:
   # Special forms aren't subject to normal evaluation rules - keep the
@@ -100,7 +103,7 @@
    macroexp = macrosym._get_value()            # Get the expander function
   .ASSERT_TYPE_AND_BRANCH(macroexp, "function", MACRO_NOT_INITIALIZED)
 
-   peek_pad macroenv                           # Get current lexical scope
+   # VALID_IN_PARROT_0_2_0  peek_pad macroenv                          # Get 
current lexical scope
 
   .LIST_3(funcargs, symbol, body, macroenv)
    retv = _FUNCTION_CALL(macroexp, funcargs)    # Call the macroexpand hook
@@ -108,7 +111,8 @@
   .LIST_1(macroarg, retv)
   _eval(macroarg)
 
-  goto DONE
+  # VALID_IN_PARROT_0_2_0 goto DONE
+  .return(retv)
 
 SYMBOL:
   symbol = form
@@ -138,35 +142,39 @@
   unless found goto SYMBOL_NOT_FOUND
 
 DONE_SYMBOL:
-  argcP = 1                                    # One value returned
-  P5 = retv                                    # Return value
-
-  goto DONE
+  # VALID_IN_PARROT_0_2_0 argcP = 1                                    # One 
value returned
+  # VALID_IN_PARROT_0_2_0 P5 = retv                                    # 
Return value
+  # VALID_IN_PARROT_0_2_0 
+  # VALID_IN_PARROT_0_2_0 goto DONE
+  .return(retv)
 
 SYMBOL_NOT_FOUND:
   .ERROR_1("unbound-variable", "variable %s has no value", form)
-  goto DONE
+  # VALID_IN_PARROT_0_2_0 goto DONE
+  .return(retv)
 
 SELF_EVALUATING_OBJECT:
   # Object is a primitive type (ie. a string, integer or float).
   retv = form
+  # VALID_IN_PARROT_0_2_0 argcP = 1                                    # One 
value returned
+  # VALID_IN_PARROT_0_2_0 P5 = retv                                    # 
Return value
 
-  argcP = 1                                    # One value returned
-  P5 = retv                                    # Return value
-
-  goto DONE
+  # VALID_IN_PARROT_0_2_0 goto DONE
+  .return(retv)
 
 MACRO_NOT_INITIALIZED:
   .ERROR_0("internal","the macro system has not been initialized")
-  goto DONE
-
-DONE:
-  is_prototyped = 0                            # Nonprototyped return
-  argcI = 0                                    # No integer values returned
-  argcN = 0                                    # No float values returned
-  argcS = 0                                    # No string values returned
+# VALID_IN_PARROT_0_2_0   goto DONE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 DONE:
+# VALID_IN_PARROT_0_2_0   is_prototyped = 0                            # 
Nonprototyped return
+# VALID_IN_PARROT_0_2_0   argcI = 0                                    # No 
integer values returned
+# VALID_IN_PARROT_0_2_0   argcN = 0                                    # No 
float values returned
+# VALID_IN_PARROT_0_2_0   argcS = 0                                    # No 
string values returned
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   returncc                                     # Call 
the return continuation
 
-  returncc                                     # Call the return continuation
+  .return()
 .end
 
 # Local Variables:

Modified: trunk/languages/lisp/include/macros/standard.pir
==============================================================================
--- trunk/languages/lisp/include/macros/standard.pir    (original)
+++ trunk/languages/lisp/include/macros/standard.pir    Sat May 12 04:09:18 2007
@@ -40,13 +40,13 @@
 
 .macro SPECIAL_FORM (S,P,N,L)
   .sym pmc _specialformp
-  .sym pmc _funcp
+  # VALID_IN_PARROT_0_2_0 .sym pmc _funcp
   .sym pmc _namep
 
-  newsub _funcp, .Sub, .L
+  # VALID_IN_PARROT_0_2_0 newsub _funcp, .Sub, .L
 
   _specialformp = new "LispSpecialForm"
-  _specialformp._set_body(_funcp)
+  # VALID_IN_PARROT_0_2_0 _specialformp._set_body(.L)
 
   _namep = new "LispString"
   _namep = .N

Modified: trunk/languages/lisp/include/macros/types.pir
==============================================================================
--- trunk/languages/lisp/include/macros/types.pir       (original)
+++ trunk/languages/lisp/include/macros/types.pir       Sat May 12 04:09:18 2007
@@ -111,9 +111,9 @@
   .sym pmc _func
 
    .F = new "LispFunction"
-   newsub _func, .Sub, .L
+   # VALID_IN_PARROT_0_2_0 newsub _func, .Sub, .L
 
-   setattribute .F, "LispFunction\0body", _func
+   # VALID_IN_PARROT_0_2_0 setattribute .F, "LispFunction\0body", .L
 .endm
 
 =head1 .MACRO(F,L)

Modified: trunk/languages/lisp/internals.pir
==============================================================================
--- trunk/languages/lisp/internals.pir  (original)
+++ trunk/languages/lisp/internals.pir  Sat May 12 04:09:18 2007
@@ -114,7 +114,8 @@
 
   symname = symbol._get_name_as_string()
 
-  store_lex -1, symname, symbol
+  # VALID_IN_PARROT_0_2_0 store_lex -1, symname, symbol
+  store_lex symname, symbol
 .end
 
 
@@ -142,7 +143,8 @@
    goto DONE
 
 DONE:
-   store_lex -1, symname, symbol
+   # VALID_IN_PARROT_0_2_0 store_lex -1, symname, symbol
+   store_lex symname, symbol
 
   .return(symbol)
 .end
@@ -221,6 +223,7 @@
 .sub _FUNCTION_CALL
   .param pmc function
   .param pmc args
+
   .local string type
   .local pmc proto
   .local pmc scope
@@ -249,11 +252,11 @@
   goto CALL_FUNCTION
 
 CALL_FUNCTION:
-  pushtopp                             # Save the upper registers
-  invokecc                             # Call the closure
-  poptopp                              # Restore the upper registers
+  # VALID_IN_PARROT_0_2_0 pushtopp                             # Save the 
upper registers
+  # VALID_IN_PARROT_0_2_0 invokecc                             # Call the 
closure
+  # VALID_IN_PARROT_0_2_0 poptopp                              # Restore the 
upper registers
 
-  returncc
+  # VALID_IN_PARROT_0_2_0 returncc
 .end
 
 .sub _IS_SPECIAL
@@ -362,7 +365,7 @@
    clargsptr = clargs
    clprotptr = clprot
 
-   new_pad -1
+   # VALID_IN_PARROT_0_2_0  new_pad -1
 
    goto CLOSURE_ARGS
 
@@ -392,18 +395,18 @@
   .LIST_1(clearg, clbody)
    clretv = _eval(clearg)
 
-   pop_pad
+   # VALID_IN_PARROT_0_2_0  pop_pad
 
    goto CLOSURE_DONE
 
 CLOSURE_TOO_FEW_ARGS:
-   pop_pad
+   # VALID_IN_PARROT_0_2_0  pop_pad
 
   .ERROR_0("program-error", "Too few arguments given to LAMBDA")
    goto CLOSURE_DONE
 
 CLOSURE_TOO_MANY_ARGS:
-   pop_pad
+   # VALID_IN_PARROT_0_2_0  pop_pad
 
   .ERROR_0("program-error", "Too many arguments given to LAMBDA")
    goto CLOSURE_DONE

Modified: trunk/languages/lisp/lisp.pir
==============================================================================
--- trunk/languages/lisp/lisp.pir       (original)
+++ trunk/languages/lisp/lisp.pir       Sat May 12 04:09:18 2007
@@ -21,12 +21,32 @@
   .local int argc
   .local int res
 
+
+    load_bytecode "PGE.pbc"               # Parrot Grammar engine
+ 
+    # compile a couble of regexes that are needed in validate.pir
+    .local pmc p6rule
+    p6rule = compreg "PGE::P6Regex"
+
+    .local pmc is_integer
+    is_integer = p6rule( "^<[+\-]>?\d+<'.'>?$" ) 
+    set_global 'is_integer', is_integer
+
+    .local pmc is_float
+    is_float = p6rule( "^<[+-]>?\d+<'.'>\d+$" ) 
+    set_global 'is_float', is_float
+
+    .local pmc is_qualified
+    # todo keyword, split into qualifier, package and symbol
+    is_qualified = p6rule( 
"^<[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]>*::<[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]>*"
 ) 
+    set_global 'is_qualified', is_qualified
+
    _init_types()                       # Initialize all the type classes.
 
    _init_cl()                          # Initialize the built-in functions in
    _init_system()                      # the SYSTEM and COMMON-LISP packages.
 
-   new_pad 0                           # Create the null lexical environment.
+    # VALID_IN_PARROT_0_2_0  new_pad 0                            # Create the 
null lexical environment.
 
 
   .STRING(name, "lisp/bootstrap.l")    # Load the lisp bootstrap file.
@@ -57,9 +77,10 @@
    retv = _read(args)
 
   .LIST_1(args, retv)                  # Eval!
-   retv = _eval(args)
+   # VALID_IN_PARROT_0_2_0 retv = _eval(args)
 
-   foldup retv
+   # VALID_IN_PARROT_0_2_0 foldup retv
+  ( retv :slurpy) = _eval(args)
 
   .local int nretv
    nretv = retv

Modified: trunk/languages/lisp/read.pir
==============================================================================
--- trunk/languages/lisp/read.pir       (original)
+++ trunk/languages/lisp/read.pir       Sat May 12 04:09:18 2007
@@ -10,6 +10,7 @@
   .local pmc stream
   .local string token
   .local pmc retv
+  .local int nretv
 
   .ASSERT_LENGTH(args,1,ERROR_NARGS)  # We should have received one argument -
                                      # the input stream to read from.
@@ -55,9 +56,13 @@
   .STRING(mchar, char)
 
   .LIST_2(margs, istream, mchar)           # Create a list of args to pass in
-   retv = _FUNCTION_CALL(macro, margs)         # Call the readmacro
+   # VALID_IN_PARROT_0_2_0 retv = _FUNCTION_CALL(macro, margs)         # Call 
the readmacro
 
-   if argcP == 0 goto STEP_1
+   # VALID_IN_PARROT_0_2_0 if argcP == 0 goto STEP_1
+   (retv :slurpy) = _FUNCTION_CALL(macro, margs)         # Call the readmacro
+   
+   nretv = retv
+   if nretv == 0 goto STEP_1
    goto DONE
 
 STEP_5:
@@ -179,6 +184,7 @@
   .local pmc stream
   .local pmc symbol
   .local pmc tretv
+  .local pmc ntretv
   .local pmc retv
   .local pmc lptr
   .local int ordv
@@ -260,7 +266,9 @@
 
    tretv = _FUNCTION_CALL(macro, margs)   # Call the readmacro
 
-   if argcP == 0 goto LOOP                # If macro is NULL, start loop again
+   # VALID_IN_PARROT_0_2_0 if argcP == 0 goto LOOP                # If macro 
is NULL, start loop again
+   ntretv = tretv
+   if ntretv == 0 goto LOOP               # If macro is NULL, start loop again
    goto APPEND_TO_LIST                    # else add the return value to list
 
 DELIMIT_CHAR:                             # We've hit the delimter char -

Modified: trunk/languages/lisp/validate.pir
==============================================================================
--- trunk/languages/lisp/validate.pir   (original)
+++ trunk/languages/lisp/validate.pir   Sat May 12 04:09:18 2007
@@ -11,10 +11,16 @@
   .local int flag
   .local pmc nil
 
-  flag = _IS_INTEGER(token)            # attempt to parse token as an integer
+  # VALID_IN_PARROT_0_2_0 flag = _IS_INTEGER(token)            # attempt to 
parse token as an integer
+  .local pmc is_integer
+  is_integer = get_global 'is_integer'
+  flag = is_integer(token)             # attempt to parse token as an integer
   if flag goto INTEGER
 
-  flag = _IS_FLOAT(token)              # attempt to parse token as a float
+  # VALID_IN_PARROT_0_2_0 flag = _IS_FLOAT(token)              # attempt to 
parse token as a float
+  .local pmc is_float
+  is_float = get_global 'is_float'
+  flag = is_float(token)               # attempt to parse token as a float
   if flag goto FLOAT
 
   goto QUALIFIED_SYMBOL                        # else interpret it as a symbol
@@ -28,7 +34,10 @@
   goto DONE
 
 QUALIFIED_SYMBOL:
-  (flag,pkgname,symname) = _IS_QUALIFIED(token)
+  # VALID_IN_PARROT_0_2_0 (flag,pkgname,symname) = _IS_QUALIFIED(token)
+  .local pmc is_qualified
+  is_qualified = get_global 'is_qualified'
+  (flag,pkgname,symname) = is_qualified(token)
   if flag != 1 goto SYMBOL
 
   retv = _LOOKUP_GLOBAL(pkgname, symname)
@@ -64,163 +73,163 @@
   .return(retv)
 .end
 
-.sub _IS_INTEGER
-  .param string token
-
-  .local int retv
-  .local int ndig
-  .local int idx
-
-  ndig = 0
-  idx  = 0
-
-SIGNS:
-  rx_oneof token, idx, '+-', DIGIT     # check for +/- signs (optional)
-  goto DIGIT
-
-DIGIT:                                 # ensure the rest is all digits
-  rx_is_d token, idx, DECIMAL
-  ndig = ndig + 1
-  goto DIGIT
-
-DECIMAL:
-  rx_literal token, idx, '.', EOS      # Check for an optional decimal point
-  goto EOS
-
-EOS:                                   # check to see if we're at string end
-  rx_zwa_atend token, idx, FAIL
-  goto MATCH
-
-MATCH:
-  if ndig == 0 goto FAIL               # ensure we had at least one digit
-  retv = 1
-  goto DONE
-
-FAIL:
-  retv = 0
-  goto DONE
-
-DONE:
-  .return(retv)
-.end
-
-.sub _IS_FLOAT
-  .param string token
-
-  .local int retv
-  .local int idx
-
-  idx  = 0
-
-SIGNS:
-  rx_oneof token, idx, '+-', PREDIGITS # check for +/- signs (optional)
-  goto PREDIGITS
-
-PREDIGITS:                             # check for pre-decimal digits
-  rx_is_d token, idx, DECIMAL
-  goto PREDIGITS
-
-DECIMAL:
-  rx_literal token, idx, '.', FAIL     # check for a decimal point
-  goto POSTDIGIT
-
-POSTDIGIT:
-  rx_is_d token, idx, FAIL             # check for at least one required digit
-  goto POSTDIGITS
-
-POSTDIGITS:                            # check for option post-decimal digits
-  rx_is_d token, idx, EOS
-  goto POSTDIGITS
-
-EOS:                                   # check to see if we're at string end
-  rx_zwa_atend token, idx, FAIL
-  goto MATCH
-
-MATCH:
-  retv = 1
-  goto DONE
-
-FAIL:
-  retv = 0
-  goto DONE
-
-DONE:
-  .return(retv)
-.end
-
-.sub _IS_QUALIFIED
-  .param string token
-
-  .local string package
-  .local string symbol
-  .local string vchar
-  .local int retv
-  .local int idx1
-  .local int idx2
-  .local int idx3
-  .local int type
-
-  vchar = 
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!$%&*<=>[EMAIL 
PROTECTED]/+"
-  idx1   = 0
-
-PACKAGE:
-  rx_oneof token, idx1, vchar, COLON
-  goto PACKAGE
-
-COLON:
-  idx2 = idx1                          # Index of last valid symbol character
-
-  rx_literal token, idx1, ':', FAIL    # If we don't have this -> not qualified
-
-  idx3 = idx1                          # Start of symbol character
-  type = 0                             # External symbol
-
-  rx_literal token, idx1, ':', SYMBOL  # If we don't have this -> not external
-
-  idx3 = idx1                          # Start of symbol character
-  type = 1                             # Internal symbol
-
-  goto SYMBOL
-
-SYMBOL:
-  rx_oneof token, idx1, vchar, EOS
-  goto SYMBOL
-
-EOS:
-  rx_zwa_atend token, idx1, FAIL       # check to see if we're at string end
-  goto MATCH
-
-KEYWORD:
-  package = "KEYWORD"
-  goto KEYWORD_RETURN
-
-MATCH:
-  idx3 = idx3
-
-KEYWORD_CHECK1:
-  if idx2 != 0 goto NOT_KEYWORD
-  if idx3 <= 2 goto KEYWORD
-  goto NOT_KEYWORD
-
-NOT_KEYWORD:
-  substr package, token, 0, idx2
-
-KEYWORD_RETURN:
-  substr symbol, token, idx3, idx1
-
-  retv = 1
-  goto DONE
-
-FAIL:
-  package = ""
-  symbol = ""
-  type = 0
-  retv = 0
-  goto DONE
-
-DONE:
-  .return(retv,package,symbol,type)
-.end
+# VALID_IN_PARROT_0_2_0 .sub _IS_INTEGER
+# VALID_IN_PARROT_0_2_0   .param string token
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   .local int retv
+# VALID_IN_PARROT_0_2_0   .local int ndig
+# VALID_IN_PARROT_0_2_0   .local int idx
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   ndig = 0
+# VALID_IN_PARROT_0_2_0   idx  = 0
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 SIGNS:
+# VALID_IN_PARROT_0_2_0   rx_oneof token, idx, '+-', DIGIT     # check for +/- 
signs (optional)
+# VALID_IN_PARROT_0_2_0   goto DIGIT
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 DIGIT:                                 # ensure the 
rest is all digits
+# VALID_IN_PARROT_0_2_0   rx_is_d token, idx, DECIMAL
+# VALID_IN_PARROT_0_2_0   ndig = ndig + 1
+# VALID_IN_PARROT_0_2_0   goto DIGIT
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 DECIMAL:
+# VALID_IN_PARROT_0_2_0   rx_literal token, idx, '.', EOS      # Check for an 
optional decimal point
+# VALID_IN_PARROT_0_2_0   goto EOS
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 EOS:                                   # check to see 
if we're at string end
+# VALID_IN_PARROT_0_2_0   rx_zwa_atend token, idx, FAIL
+# VALID_IN_PARROT_0_2_0   goto MATCH
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 MATCH:
+# VALID_IN_PARROT_0_2_0   if ndig == 0 goto FAIL               # ensure we had 
at least one digit
+# VALID_IN_PARROT_0_2_0   retv = 1
+# VALID_IN_PARROT_0_2_0   goto DONE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 FAIL:
+# VALID_IN_PARROT_0_2_0   retv = 0
+# VALID_IN_PARROT_0_2_0   goto DONE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 DONE:
+# VALID_IN_PARROT_0_2_0   .return(retv)
+# VALID_IN_PARROT_0_2_0 .end
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 .sub _IS_FLOAT
+# VALID_IN_PARROT_0_2_0   .param string token
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   .local int retv
+# VALID_IN_PARROT_0_2_0   .local int idx
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   idx  = 0
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 SIGNS:
+# VALID_IN_PARROT_0_2_0   rx_oneof token, idx, '+-', PREDIGITS # check for +/- 
signs (optional)
+# VALID_IN_PARROT_0_2_0   goto PREDIGITS
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 PREDIGITS:                             # check for 
pre-decimal digits
+# VALID_IN_PARROT_0_2_0   rx_is_d token, idx, DECIMAL
+# VALID_IN_PARROT_0_2_0   goto PREDIGITS
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 DECIMAL:
+# VALID_IN_PARROT_0_2_0   rx_literal token, idx, '.', FAIL     # check for a 
decimal point
+# VALID_IN_PARROT_0_2_0   goto POSTDIGIT
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 POSTDIGIT:
+# VALID_IN_PARROT_0_2_0   rx_is_d token, idx, FAIL             # check for at 
least one required digit
+# VALID_IN_PARROT_0_2_0   goto POSTDIGITS
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 POSTDIGITS:                            # check for 
option post-decimal digits
+# VALID_IN_PARROT_0_2_0   rx_is_d token, idx, EOS
+# VALID_IN_PARROT_0_2_0   goto POSTDIGITS
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 EOS:                                   # check to see 
if we're at string end
+# VALID_IN_PARROT_0_2_0   rx_zwa_atend token, idx, FAIL
+# VALID_IN_PARROT_0_2_0   goto MATCH
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 MATCH:
+# VALID_IN_PARROT_0_2_0   retv = 1
+# VALID_IN_PARROT_0_2_0   goto DONE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 FAIL:
+# VALID_IN_PARROT_0_2_0   retv = 0
+# VALID_IN_PARROT_0_2_0   goto DONE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 DONE:
+# VALID_IN_PARROT_0_2_0   .return(retv)
+# VALID_IN_PARROT_0_2_0 .end
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 .sub _IS_QUALIFIED
+# VALID_IN_PARROT_0_2_0   .param string token
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   .local string package
+# VALID_IN_PARROT_0_2_0   .local string symbol
+# VALID_IN_PARROT_0_2_0   .local string vchar
+# VALID_IN_PARROT_0_2_0   .local int retv
+# VALID_IN_PARROT_0_2_0   .local int idx1
+# VALID_IN_PARROT_0_2_0   .local int idx2
+# VALID_IN_PARROT_0_2_0   .local int idx3
+# VALID_IN_PARROT_0_2_0   .local int type
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   vchar = 
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!$%&*<=>[EMAIL 
PROTECTED]/+"
+# VALID_IN_PARROT_0_2_0   idx1   = 0
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 PACKAGE:
+# VALID_IN_PARROT_0_2_0   rx_oneof token, idx1, vchar, COLON
+# VALID_IN_PARROT_0_2_0   goto PACKAGE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 COLON:
+# VALID_IN_PARROT_0_2_0   idx2 = idx1                          # Index of last 
valid symbol character
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   rx_literal token, idx1, ':', FAIL    # If we don't 
have this -> not qualified
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   idx3 = idx1                          # Start of 
symbol character
+# VALID_IN_PARROT_0_2_0   type = 0                             # External 
symbol
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   rx_literal token, idx1, ':', SYMBOL  # If we don't 
have this -> not external
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   idx3 = idx1                          # Start of 
symbol character
+# VALID_IN_PARROT_0_2_0   type = 1                             # Internal 
symbol
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   goto SYMBOL
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 SYMBOL:
+# VALID_IN_PARROT_0_2_0   rx_oneof token, idx1, vchar, EOS
+# VALID_IN_PARROT_0_2_0   goto SYMBOL
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 EOS:
+# VALID_IN_PARROT_0_2_0   rx_zwa_atend token, idx1, FAIL       # check to see 
if we're at string end
+# VALID_IN_PARROT_0_2_0   goto MATCH
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 KEYWORD:
+# VALID_IN_PARROT_0_2_0   package = "KEYWORD"
+# VALID_IN_PARROT_0_2_0   goto KEYWORD_RETURN
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 MATCH:
+# VALID_IN_PARROT_0_2_0   idx3 = idx3
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 KEYWORD_CHECK1:
+# VALID_IN_PARROT_0_2_0   if idx2 != 0 goto NOT_KEYWORD
+# VALID_IN_PARROT_0_2_0   if idx3 <= 2 goto KEYWORD
+# VALID_IN_PARROT_0_2_0   goto NOT_KEYWORD
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 NOT_KEYWORD:
+# VALID_IN_PARROT_0_2_0   substr package, token, 0, idx2
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 KEYWORD_RETURN:
+# VALID_IN_PARROT_0_2_0   substr symbol, token, idx3, idx1
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0   retv = 1
+# VALID_IN_PARROT_0_2_0   goto DONE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 FAIL:
+# VALID_IN_PARROT_0_2_0   package = ""
+# VALID_IN_PARROT_0_2_0   symbol = ""
+# VALID_IN_PARROT_0_2_0   type = 0
+# VALID_IN_PARROT_0_2_0   retv = 0
+# VALID_IN_PARROT_0_2_0   goto DONE
+# VALID_IN_PARROT_0_2_0 
+# VALID_IN_PARROT_0_2_0 DONE:
+# VALID_IN_PARROT_0_2_0   .return(retv,package,symbol,type)
+# VALID_IN_PARROT_0_2_0 .end
 
 # Local Variables:
 #   mode: pir

Reply via email to