Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: master
...
compare: nqp-p6
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 71 files changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 22, 2012
@rurban rurban use nqp-p6 from the perl repo as new nqp fa1d099
@rurban rurban remove ext/nqp-rx ead25e1
@rurban rurban rename parrot-nqp to nqp
Also mark TODO portability in the makefile.
As discussed with pmichaud, we should git submodule to some safe-points,such as
nqp tags. jonathan is planning to revamp 6model a bit later, which should not affect us.
pmichaud does not want to abstract 6model into a seperate git repo, so we should
either copy it, or use it from ext/nqp-p6.
5208149
@rurban rurban chmod nqp to 755 as perl ExtUtils::Command cp is still not copying perms 0510f6d
Showing with 57 additions and 59,174 deletions.
  1. +3 −0  .gitmodules
  2. +0 −65 MANIFEST
  3. +2 −2 compilers/data_json/Rules.mak
  4. +21 −21 compilers/opsc/Rules.mak
  5. +30 −19 config/gen/makefiles/root.in
  6. +1 −0  ext/nqp-p6
  7. +0 −24 ext/nqp-rx/CREDITS
  8. +0 −14 ext/nqp-rx/Defines.mak
  9. +0 −201 ext/nqp-rx/LICENSE
  10. +0 −97 ext/nqp-rx/README
  11. +0 −33 ext/nqp-rx/Rules.mak
  12. +0 −70 ext/nqp-rx/STATUS
  13. +0 −8,998 ext/nqp-rx/src/stage0/HLL-s0.pir
  14. +0 −28,382 ext/nqp-rx/src/stage0/NQP-s0.pir
  15. +0 −14,226 ext/nqp-rx/src/stage0/P6Regex-s0.pir
  16. +0 −3,885 ext/nqp-rx/src/stage0/Regex-s0.pir
  17. +0 −320 ext/nqp-rx/src/stage0/nqp-setting.nqp
  18. +0 −20 ext/nqp-rx/t/nqp/01-literals.t
  19. +0 −25 ext/nqp-rx/t/nqp/02-if.t
  20. +0 −132 ext/nqp-rx/t/nqp/03-if-else.t
  21. +0 −25 ext/nqp-rx/t/nqp/04-unless.t
  22. +0 −13 ext/nqp-rx/t/nqp/05-comments.t
  23. +0 −9 ext/nqp-rx/t/nqp/06-args-pos.t
  24. +0 −27 ext/nqp-rx/t/nqp/07-boolean.t
  25. +0 −33 ext/nqp-rx/t/nqp/08-blocks.t
  26. +0 −76 ext/nqp-rx/t/nqp/09-var.t
  27. +0 −98 ext/nqp-rx/t/nqp/10-cmp.t
  28. +0 −76 ext/nqp-rx/t/nqp/11-sub.t
  29. +0 −33 ext/nqp-rx/t/nqp/12-logical.t
  30. +0 −48 ext/nqp-rx/t/nqp/13-op.t
  31. +0 −97 ext/nqp-rx/t/nqp/14-while.t
  32. +0 −12 ext/nqp-rx/t/nqp/15-list.t
  33. +0 −23 ext/nqp-rx/t/nqp/16-ternary.t
  34. +0 −23 ext/nqp-rx/t/nqp/17-positional.t
  35. +0 −27 ext/nqp-rx/t/nqp/18-associative.t
  36. +0 −10 ext/nqp-rx/t/nqp/19-inline.t
  37. +0 −23 ext/nqp-rx/t/nqp/20-return.t
  38. +0 −28 ext/nqp-rx/t/nqp/21-contextual.t
  39. +0 −30 ext/nqp-rx/t/nqp/22-optional-args.t
  40. +0 −20 ext/nqp-rx/t/nqp/23-named-args.t
  41. +0 −19 ext/nqp-rx/t/nqp/24-module.t
  42. +0 −15 ext/nqp-rx/t/nqp/25-class.t
  43. +0 −30 ext/nqp-rx/t/nqp/26-methodops.t
  44. +0 −28 ext/nqp-rx/t/nqp/27-self.t
  45. +0 −34 ext/nqp-rx/t/nqp/28-subclass.t
  46. +0 −19 ext/nqp-rx/t/nqp/29-make.t
  47. +0 −11 ext/nqp-rx/t/nqp/30-pirop.t
  48. +0 −22 ext/nqp-rx/t/nqp/31-grammar.t
  49. +0 −32 ext/nqp-rx/t/nqp/32-protoregex.t
  50. +0 −23 ext/nqp-rx/t/nqp/33-init.t
  51. +0 −32 ext/nqp-rx/t/nqp/34-rxcodeblock.t
  52. +0 −18 ext/nqp-rx/t/nqp/35-prefix-sigil.t
  53. +0 −8 ext/nqp-rx/t/nqp/36-callable.t
  54. +0 −20 ext/nqp-rx/t/nqp/37-slurpy.t
  55. +0 −19 ext/nqp-rx/t/nqp/38-quotes.t
  56. +0 −18 ext/nqp-rx/t/nqp/39-pointy.t
  57. +0 −46 ext/nqp-rx/t/nqp/40-lists.t
  58. +0 −15 ext/nqp-rx/t/nqp/41-flat.t
  59. +0 −40 ext/nqp-rx/t/nqp/42-cond-loop.t
  60. +0 −496 ext/nqp-rx/t/p6regex/01-regex.t
  61. +0 −33 ext/nqp-rx/t/p6regex/rx_backtrack
  62. +0 −10 ext/nqp-rx/t/p6regex/rx_basic
  63. +0 −63 ext/nqp-rx/t/p6regex/rx_captures
  64. +0 −82 ext/nqp-rx/t/p6regex/rx_charclass
  65. +0 −14 ext/nqp-rx/t/p6regex/rx_goal
  66. +0 −48 ext/nqp-rx/t/p6regex/rx_lookarounds
  67. +0 −263 ext/nqp-rx/t/p6regex/rx_metachars
  68. +0 −154 ext/nqp-rx/t/p6regex/rx_modifiers
  69. +0 −189 ext/nqp-rx/t/p6regex/rx_quantifiers
  70. +0 −67 ext/nqp-rx/t/p6regex/rx_subrules
  71. +0 −41 ext/nqp-rx/t/p6regex/rx_syntax
View
3  .gitmodules
@@ -0,0 +1,3 @@
+[submodule "ext/nqp-p6"]
+ path = ext/nqp-p6
+ url = http://github.com/perl6/nqp.git
View
65 MANIFEST
@@ -794,71 +794,6 @@ examples/tutorial/82_coroutine.pir [examples]
examples/tutorial/83_external_libraries.pir [examples]
examples/tutorial/90_writing_tests.pir [examples]
ext/README.pod []doc
-ext/nqp-rx/CREDITS []
-ext/nqp-rx/Defines.mak []
-ext/nqp-rx/LICENSE []
-ext/nqp-rx/README []doc
-ext/nqp-rx/Rules.mak []
-ext/nqp-rx/STATUS []
-ext/nqp-rx/src/stage0/HLL-s0.pir []
-ext/nqp-rx/src/stage0/NQP-s0.pir []
-ext/nqp-rx/src/stage0/P6Regex-s0.pir []
-ext/nqp-rx/src/stage0/Regex-s0.pir []
-ext/nqp-rx/src/stage0/nqp-setting.nqp []
-ext/nqp-rx/t/nqp/01-literals.t [test]
-ext/nqp-rx/t/nqp/02-if.t [test]
-ext/nqp-rx/t/nqp/03-if-else.t [test]
-ext/nqp-rx/t/nqp/04-unless.t [test]
-ext/nqp-rx/t/nqp/05-comments.t [test]
-ext/nqp-rx/t/nqp/06-args-pos.t [test]
-ext/nqp-rx/t/nqp/07-boolean.t [test]
-ext/nqp-rx/t/nqp/08-blocks.t [test]
-ext/nqp-rx/t/nqp/09-var.t [test]
-ext/nqp-rx/t/nqp/10-cmp.t [test]
-ext/nqp-rx/t/nqp/11-sub.t [test]
-ext/nqp-rx/t/nqp/12-logical.t [test]
-ext/nqp-rx/t/nqp/13-op.t [test]
-ext/nqp-rx/t/nqp/14-while.t [test]
-ext/nqp-rx/t/nqp/15-list.t [test]
-ext/nqp-rx/t/nqp/16-ternary.t [test]
-ext/nqp-rx/t/nqp/17-positional.t [test]
-ext/nqp-rx/t/nqp/18-associative.t [test]
-ext/nqp-rx/t/nqp/19-inline.t [test]
-ext/nqp-rx/t/nqp/20-return.t [test]
-ext/nqp-rx/t/nqp/21-contextual.t [test]
-ext/nqp-rx/t/nqp/22-optional-args.t [test]
-ext/nqp-rx/t/nqp/23-named-args.t [test]
-ext/nqp-rx/t/nqp/24-module.t [test]
-ext/nqp-rx/t/nqp/25-class.t [test]
-ext/nqp-rx/t/nqp/26-methodops.t [test]
-ext/nqp-rx/t/nqp/27-self.t [test]
-ext/nqp-rx/t/nqp/28-subclass.t [test]
-ext/nqp-rx/t/nqp/29-make.t [test]
-ext/nqp-rx/t/nqp/30-pirop.t [test]
-ext/nqp-rx/t/nqp/31-grammar.t [test]
-ext/nqp-rx/t/nqp/32-protoregex.t [test]
-ext/nqp-rx/t/nqp/33-init.t [test]
-ext/nqp-rx/t/nqp/34-rxcodeblock.t [test]
-ext/nqp-rx/t/nqp/35-prefix-sigil.t [test]
-ext/nqp-rx/t/nqp/36-callable.t [test]
-ext/nqp-rx/t/nqp/37-slurpy.t [test]
-ext/nqp-rx/t/nqp/38-quotes.t [test]
-ext/nqp-rx/t/nqp/39-pointy.t [test]
-ext/nqp-rx/t/nqp/40-lists.t [test]
-ext/nqp-rx/t/nqp/41-flat.t [test]
-ext/nqp-rx/t/nqp/42-cond-loop.t [test]
-ext/nqp-rx/t/p6regex/01-regex.t [test]
-ext/nqp-rx/t/p6regex/rx_backtrack [test]
-ext/nqp-rx/t/p6regex/rx_basic [test]
-ext/nqp-rx/t/p6regex/rx_captures [test]
-ext/nqp-rx/t/p6regex/rx_charclass [test]
-ext/nqp-rx/t/p6regex/rx_goal [test]
-ext/nqp-rx/t/p6regex/rx_lookarounds [test]
-ext/nqp-rx/t/p6regex/rx_metachars [test]
-ext/nqp-rx/t/p6regex/rx_modifiers [test]
-ext/nqp-rx/t/p6regex/rx_quantifiers [test]
-ext/nqp-rx/t/p6regex/rx_subrules [test]
-ext/nqp-rx/t/p6regex/rx_syntax [test]
ext/winxed/Defines.mak []
ext/winxed/LICENSE []
ext/winxed/README.pod []doc
View
4 compilers/data_json/Rules.mak
@@ -2,9 +2,9 @@ runtime/parrot/languages/data_json/data_json.pbc: compilers/data_json/data_json.
$(MKPATH) runtime/parrot/languages/data_json
$(CP) compilers/data_json/data_json.pbc $@
-runtime/parrot/languages/JSON/JSON.pir: compilers/data_json/JSON.nqp $(NQP_RX)
+runtime/parrot/languages/JSON/JSON.pir: compilers/data_json/JSON.nqp $(NQP)
$(MKPATH) runtime/parrot/languages/JSON
- $(NQP_RX) --target=pir compilers/data_json/JSON.nqp > $@
+ $(NQP) --target=pir compilers/data_json/JSON.nqp > $@
compilers/data_json/data_json.pbc : \
$(LIBRARY_DIR)/PGE.pbc \
View
42 compilers/opsc/Rules.mak
@@ -1,38 +1,38 @@
-$(LIBRARY_DIR)/opsc.pbc: $(NQP_RX) $(OPSC_SOURCES) $(NQPRX_LIB_SETTING)
+$(LIBRARY_DIR)/opsc.pbc: $(NQP) $(OPSC_SOURCES) $(NQPRX_LIB_SETTING)
$(PARROT) -o $(LIBRARY_DIR)/opsc.pbc $(OPSC_DIR)/opsc.pir
-$(OPSC_DIR)/gen/Ops/Compiler.pir: $(OPSC_DIR)/src/Ops/Compiler.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Compiler.pm
+$(OPSC_DIR)/gen/Ops/Compiler.pir: $(OPSC_DIR)/src/Ops/Compiler.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Compiler.pm
-$(OPSC_DIR)/gen/Ops/Compiler/Actions.pir: $(OPSC_DIR)/src/Ops/Compiler/Actions.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Compiler/Actions.pm
+$(OPSC_DIR)/gen/Ops/Compiler/Actions.pir: $(OPSC_DIR)/src/Ops/Compiler/Actions.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Compiler/Actions.pm
-$(OPSC_DIR)/gen/Ops/Compiler/Grammar.pir: $(OPSC_DIR)/src/Ops/Compiler/Grammar.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Compiler/Grammar.pm
+$(OPSC_DIR)/gen/Ops/Compiler/Grammar.pir: $(OPSC_DIR)/src/Ops/Compiler/Grammar.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Compiler/Grammar.pm
-$(OPSC_DIR)/gen/Ops/Emitter.pir: $(OPSC_DIR)/src/Ops/Emitter.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Emitter.pm
+$(OPSC_DIR)/gen/Ops/Emitter.pir: $(OPSC_DIR)/src/Ops/Emitter.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Emitter.pm
-$(OPSC_DIR)/gen/Ops/File.pir: $(OPSC_DIR)/src/Ops/File.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/File.pm
+$(OPSC_DIR)/gen/Ops/File.pir: $(OPSC_DIR)/src/Ops/File.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/File.pm
-$(OPSC_DIR)/gen/Ops/Op.pir: $(OPSC_DIR)/src/Ops/Op.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Op.pm
+$(OPSC_DIR)/gen/Ops/Op.pir: $(OPSC_DIR)/src/Ops/Op.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Op.pm
-$(OPSC_DIR)/gen/Ops/OpLib.pir: $(OPSC_DIR)/src/Ops/OpLib.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/OpLib.pm
+$(OPSC_DIR)/gen/Ops/OpLib.pir: $(OPSC_DIR)/src/Ops/OpLib.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/OpLib.pm
-$(OPSC_DIR)/gen/Ops/Trans.pir: $(OPSC_DIR)/src/Ops/Trans.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Trans.pm
+$(OPSC_DIR)/gen/Ops/Trans.pir: $(OPSC_DIR)/src/Ops/Trans.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Trans.pm
-$(OPSC_DIR)/gen/Ops/Trans/C.pir: $(OPSC_DIR)/src/Ops/Trans/C.pm $(NQP_RX)
- $(NQP_RX) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Trans/C.pm
+$(OPSC_DIR)/gen/Ops/Trans/C.pir: $(OPSC_DIR)/src/Ops/Trans/C.pm $(NQP)
+ $(NQP) --target=pir --output=$@ $(OPSC_DIR)/src/Ops/Trans/C.pm
# Target to force rebuild opsc from main Makefile
$(OPSC_DIR)/ops2c.nqp: $(LIBRARY_DIR)/opsc.pbc
-$(OPS2C): $(OPSC_DIR)/ops2c.nqp $(LIBRARY_DIR)/opsc.pbc $(NQP_RX) $(PBC_TO_EXE)
- $(NQP_RX) --target=pir $(OPSC_DIR)/ops2c.nqp >ops2c.pir
+$(OPS2C): $(OPSC_DIR)/ops2c.nqp $(LIBRARY_DIR)/opsc.pbc $(NQP) $(PBC_TO_EXE)
+ $(NQP) --target=pir $(OPSC_DIR)/ops2c.nqp >ops2c.pir
$(PARROT) -o ops2c.pbc ops2c.pir
$(PBC_TO_EXE) ops2c.pbc
View
49 config/gen/makefiles/root.in
@@ -140,7 +140,6 @@ include compilers/tge/Defines.mak
include compilers/pge/Defines.mak
include compilers/pct/Defines.mak
include compilers/opsc/Defines.mak
-include ext/nqp-rx/Defines.mak
include compilers/data_json/Defines.mak
include ext/winxed/Defines.mak
@@ -534,7 +533,7 @@ PBC_MERGE = .@slash@pbc_merge$(EXE)
PDB = .@slash@parrot_debugger$(EXE)
PBC_TO_EXE = .@slash@pbc_to_exe$(EXE)
PARROT_CONFIG = .@slash@parrot_config$(EXE)
-NQP_RX = .@slash@parrot-nqp$(EXE)
+NQP = .@slash@nqp$(EXE)
NCI_THUNK_GEN = .@slash@parrot_nci_thunk_gen$(EXE)
PARROT_PROVE = .@slash@parrot-prove$(EXE)
OPS2C = .@slash@ops2c$(EXE)
@@ -548,7 +547,7 @@ INSTALLABLEPBC_MERGE = .@slash@installable_pbc_merge$(EXE)
INSTALLABLEPBCTOEXE = .@slash@installable_pbc_to_exe$(EXE)
INSTALLABLEPDB = .@slash@installable_parrot_debugger$(EXE)
INSTALLABLECONFIG = .@slash@installable_parrot_config$(EXE)
-INSTALLABLENQP = .@slash@installable_parrot-nqp$(EXE)
+INSTALLABLENQP = .@slash@installable_nqp$(EXE)
INSTALLABLENCITHUNKGEN = .@slash@installable_parrot_nci_thunk_gen$(EXE)
INSTALLABLEPARROT_PROVE = .@slash@installable_parrot-prove$(EXE)
INSTALLABLEOPS2C = .@slash@installable_ops2c$(EXE)
@@ -627,7 +626,7 @@ all : \
$(PBC_MERGE) \
$(PDB) \
$(PDUMP) \
- $(NQP_RX) \
+ $(NQP) \
$(TGE_LIB_PBCS) \
$(PGE_LIB_PBCS) \
$(PCT_LIB_PBCS) \
@@ -1223,40 +1222,37 @@ $(LIBRARY_DIR)/ProfTest.pbc: $(LIBRARY_DIR)/ProfTest/PIRProfile.pbc \
$(LIBRARY_DIR)/ProfTest/NQPProfile.pbc $(LIBRARY_DIR)/ProfTest/Matcher.pbc \
$(LIBRARY_DIR)/ProfTest/Want.pbc
-
$(LIBRARY_DIR)/ProfTest/PIRProfile.pbc: $(LIBRARY_DIR)/ProfTest/PIRProfile.pir
$(PARROT) -o $@ $(LIBRARY_DIR)/ProfTest/PIRProfile.pir
-$(LIBRARY_DIR)/ProfTest/PIRProfile.pir: $(LIBRARY_DIR)/ProfTest/PIRProfile.nqp $(NQP_RX)
- $(NQP_RX) --target=pir $(LIBRARY_DIR)/ProfTest/PIRProfile.nqp > $@
-
+$(LIBRARY_DIR)/ProfTest/PIRProfile.pir: $(LIBRARY_DIR)/ProfTest/PIRProfile.nqp $(NQP)
+ $(NQP) --target=pir $(LIBRARY_DIR)/ProfTest/PIRProfile.nqp > $@
$(LIBRARY_DIR)/ProfTest/NQPProfile.pbc: $(LIBRARY_DIR)/ProfTest/NQPProfile.pir
$(PARROT) -o $@ $(LIBRARY_DIR)/ProfTest/NQPProfile.pir
-$(LIBRARY_DIR)/ProfTest/NQPProfile.pir: $(LIBRARY_DIR)/ProfTest/NQPProfile.nqp $(NQP_RX)
- $(NQP_RX) --target=pir $(LIBRARY_DIR)/ProfTest/NQPProfile.nqp > $@
-
+$(LIBRARY_DIR)/ProfTest/NQPProfile.pir: $(LIBRARY_DIR)/ProfTest/NQPProfile.nqp $(NQP)
+ $(NQP) --target=pir $(LIBRARY_DIR)/ProfTest/NQPProfile.nqp > $@
$(LIBRARY_DIR)/ProfTest/Want.pbc: $(LIBRARY_DIR)/ProfTest/Want.pir
$(PARROT) -o $@ $(LIBRARY_DIR)/ProfTest/Want.pir
-$(LIBRARY_DIR)/ProfTest/Want.pir: $(LIBRARY_DIR)/ProfTest/Want.nqp $(NQP_RX)
- $(NQP_RX) --target=pir $(LIBRARY_DIR)/ProfTest/Want.nqp > $@
+$(LIBRARY_DIR)/ProfTest/Want.pir: $(LIBRARY_DIR)/ProfTest/Want.nqp $(NQP)
+ $(NQP) --target=pir $(LIBRARY_DIR)/ProfTest/Want.nqp > $@
$(LIBRARY_DIR)/ProfTest/Matcher.pbc: $(LIBRARY_DIR)/ProfTest/Matcher.pir
$(PARROT) -o $@ $(LIBRARY_DIR)/ProfTest/Matcher.pir
-$(LIBRARY_DIR)/ProfTest/Matcher.pir: $(LIBRARY_DIR)/ProfTest/Matcher.nqp $(NQP_RX)
- $(NQP_RX) --target=pir $(LIBRARY_DIR)/ProfTest/Matcher.nqp > $@
+$(LIBRARY_DIR)/ProfTest/Matcher.pir: $(LIBRARY_DIR)/ProfTest/Matcher.nqp $(NQP)
+ $(NQP) --target=pir $(LIBRARY_DIR)/ProfTest/Matcher.nqp > $@
#
# YAML::Tiny
#
-$(LIBRARY_DIR)/YAML/Tiny.pir: $(LIBRARY_DIR)/YAML/Tiny.pm $(NQP_RX)
- $(NQP_RX) --target=pir $(LIBRARY_DIR)/YAML/Tiny.pm > $@
+$(LIBRARY_DIR)/YAML/Tiny.pir: $(LIBRARY_DIR)/YAML/Tiny.pm $(NQP)
+ $(NQP) --target=pir $(LIBRARY_DIR)/YAML/Tiny.pm > $@
$(LIBRARY_DIR)/YAML/Tiny.pbc: $(LIBRARY_DIR)/YAML/Tiny.pir
$(PARROT) -o $@ $(LIBRARY_DIR)/YAML/Tiny.pir
@@ -2069,7 +2065,8 @@ pdf-clean:
###############################################################################
ext-clean:
- $(RM_RF) $(NQPRX_LIB_PBCS) $(NQPRX_LIB_SETTING) parrot-nqp*
+ $(RM_RF) $(NQP)
+ $(MAKE_C) ext/nqp-p6 clean
###############################################################################
#
@@ -3169,9 +3166,23 @@ include compilers/pct/Rules.mak
include compilers/opsc/Rules.mak
include compilers/tge/Rules.mak
include compilers/data_json/Rules.mak
-include ext/nqp-rx/Rules.mak
include ext/winxed/Rules.mak
+$(NQP): ext/nqp-p6/nqp.pbc $(PBC_TO_EXE)
+ $(PBC_TO_EXE) ext/nqp-p6/nqp.pbc
+ $(CP) ext/nqp-p6/nqp$(EXE) $(NQP)
+ $(CHMOD) 755 $(NQP)
+
+ext/nqp-p6/nqp.pbc: ext/nqp-p6/Makefile
+
+ext/nqp-p6/Makefile: $(PARROT)
+ @echo TODO portability
+ cd ext/nqp-p6 && $(PERL) Configure.pl --with-parrot=../../parrot
+ $(MAKE_C) ext/nqp-p6
+
+$(INSTALLLLABLENQP): $(NQP) ext/nqp-p6/nqp.pbc src/install_config$(O) $(PBC_TO_EXE)
+ $(PBC_TO_EXE) ext/nqp-p6/nqp.pbc --install
+
# Local variables:
# mode: makefile
# End:
1  ext/nqp-p6
@@ -0,0 +1 @@
+Subproject commit de089eb5767935586aea50c079e02686d0385028
View
24 ext/nqp-rx/CREDITS
@@ -1,24 +0,0 @@
-=pod
-
- Following in the steps of other open source projects that
- eventually take over the world, here is the partial list
- of people who have contributed to Rakudo and its supporting
- works. It is sorted by name and formatted to allow easy
- grepping and beautification by scripts.
- The fields are: name (N), email (E), web-address (W),
- description (D), Git username (U) and snail-mail
- address (S).
-
- Thanks,
-
- The NQP Team
- PS: Yes, this looks remarkably like the Linux CREDITS format
- PPS: This file is encoded in UTF-8
-
-----------
-N: Patrick R. Michaud
-U: pmichaud
-D: Perl 6 (Rakudo Perl) lead developer, pumpking
-E: pmichaud@pobox.com
-
-=cut
View
14 ext/nqp-rx/Defines.mak
@@ -1,14 +0,0 @@
-NQPRX_LIB_PBCS = \
- $(LIBRARY_DIR)/Regex.pbc \
- $(LIBRARY_DIR)/HLL.pbc \
- $(LIBRARY_DIR)/P6Regex.pbc \
- $(LIBRARY_DIR)/nqp-rx.pbc \
- $(LIBRARY_DIR)/P6object.pbc \
- $(LIBRARY_DIR)/PCT/HLLCompiler.pbc \
- $(LIBRARY_DIR)/PCT/PAST.pbc
-
-NQPRX_LIB_SETTING = $(LIBRARY_DIR)/nqp-setting.pbc
-
-NQPRX_CLEANUPS = \
- ext/nqp-rx/src/stage0/nqp-setting.pir
-
View
201 ext/nqp-rx/LICENSE
@@ -1,201 +0,0 @@
- The Artistic License 2.0
-
- Copyright (c) 2000-2006, The Perl Foundation.
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-Preamble
-
-This license establishes the terms under which a given free software
-Package may be copied, modified, distributed, and/or redistributed.
-The intent is that the Copyright Holder maintains some artistic
-control over the development of that Package while still keeping the
-Package available as open source and free software.
-
-You are always permitted to make arrangements wholly outside of this
-license directly with the Copyright Holder of a given Package. If the
-terms of this license do not permit the full use that you propose to
-make of the Package, you should contact the Copyright Holder and seek
-a different licensing arrangement.
-
-Definitions
-
- "Copyright Holder" means the individual(s) or organization(s)
- named in the copyright notice for the entire Package.
-
- "Contributor" means any party that has contributed code or other
- material to the Package, in accordance with the Copyright Holder's
- procedures.
-
- "You" and "your" means any person who would like to copy,
- distribute, or modify the Package.
-
- "Package" means the collection of files distributed by the
- Copyright Holder, and derivatives of that collection and/or of
- those files. A given Package may consist of either the Standard
- Version, or a Modified Version.
-
- "Distribute" means providing a copy of the Package or making it
- accessible to anyone else, or in the case of a company or
- organization, to others outside of your company or organization.
-
- "Distributor Fee" means any fee that you charge for Distributing
- this Package or providing support for this Package to another
- party. It does not mean licensing fees.
-
- "Standard Version" refers to the Package if it has not been
- modified, or has been modified only in ways explicitly requested
- by the Copyright Holder.
-
- "Modified Version" means the Package, if it has been changed, and
- such changes were not explicitly requested by the Copyright
- Holder.
-
- "Original License" means this Artistic License as Distributed with
- the Standard Version of the Package, in its current version or as
- it may be modified by The Perl Foundation in the future.
-
- "Source" form means the source code, documentation source, and
- configuration files for the Package.
-
- "Compiled" form means the compiled bytecode, object code, binary,
- or any other form resulting from mechanical transformation or
- translation of the Source form.
-
-
-Permission for Use and Modification Without Distribution
-
-(1) You are permitted to use the Standard Version and create and use
-Modified Versions for any purpose without restriction, provided that
-you do not Distribute the Modified Version.
-
-
-Permissions for Redistribution of the Standard Version
-
-(2) You may Distribute verbatim copies of the Source form of the
-Standard Version of this Package in any medium without restriction,
-either gratis or for a Distributor Fee, provided that you duplicate
-all of the original copyright notices and associated disclaimers. At
-your discretion, such verbatim copies may or may not include a
-Compiled form of the Package.
-
-(3) You may apply any bug fixes, portability changes, and other
-modifications made available from the Copyright Holder. The resulting
-Package will still be considered the Standard Version, and as such
-will be subject to the Original License.
-
-
-Distribution of Modified Versions of the Package as Source
-
-(4) You may Distribute your Modified Version as Source (either gratis
-or for a Distributor Fee, and with or without a Compiled form of the
-Modified Version) provided that you clearly document how it differs
-from the Standard Version, including, but not limited to, documenting
-any non-standard features, executables, or modules, and provided that
-you do at least ONE of the following:
-
- (a) make the Modified Version available to the Copyright Holder
- of the Standard Version, under the Original License, so that the
- Copyright Holder may include your modifications in the Standard
- Version.
-
- (b) ensure that installation of your Modified Version does not
- prevent the user installing or running the Standard Version. In
- addition, the Modified Version must bear a name that is different
- from the name of the Standard Version.
-
- (c) allow anyone who receives a copy of the Modified Version to
- make the Source form of the Modified Version available to others
- under
-
- (i) the Original License or
-
- (ii) a license that permits the licensee to freely copy,
- modify and redistribute the Modified Version using the same
- licensing terms that apply to the copy that the licensee
- received, and requires that the Source form of the Modified
- Version, and of any works derived from it, be made freely
- available in that license fees are prohibited but Distributor
- Fees are allowed.
-
-
-Distribution of Compiled Forms of the Standard Version
-or Modified Versions without the Source
-
-(5) You may Distribute Compiled forms of the Standard Version without
-the Source, provided that you include complete instructions on how to
-get the Source of the Standard Version. Such instructions must be
-valid at the time of your distribution. If these instructions, at any
-time while you are carrying out such distribution, become invalid, you
-must provide new instructions on demand or cease further distribution.
-If you provide valid instructions or cease distribution within thirty
-days after you become aware that the instructions are invalid, then
-you do not forfeit any of your rights under this license.
-
-(6) You may Distribute a Modified Version in Compiled form without
-the Source, provided that you comply with Section 4 with respect to
-the Source of the Modified Version.
-
-
-Aggregating or Linking the Package
-
-(7) You may aggregate the Package (either the Standard Version or
-Modified Version) with other packages and Distribute the resulting
-aggregation provided that you do not charge a licensing fee for the
-Package. Distributor Fees are permitted, and licensing fees for other
-components in the aggregation are permitted. The terms of this license
-apply to the use and Distribution of the Standard or Modified Versions
-as included in the aggregation.
-
-(8) You are permitted to link Modified and Standard Versions with
-other works, to embed the Package in a larger work of your own, or to
-build stand-alone binary or bytecode versions of applications that
-include the Package, and Distribute the result without restriction,
-provided the result does not expose a direct interface to the Package.
-
-
-Items That are Not Considered Part of a Modified Version
-
-(9) Works (including, but not limited to, modules and scripts) that
-merely extend or make use of the Package, do not, by themselves, cause
-the Package to be a Modified Version. In addition, such works are not
-considered parts of the Package itself, and are not subject to the
-terms of this license.
-
-
-General Provisions
-
-(10) Any use, modification, and distribution of the Standard or
-Modified Versions is governed by this Artistic License. By using,
-modifying or distributing the Package, you accept this license. Do not
-use, modify, or distribute the Package, if you do not accept this
-license.
-
-(11) If your Modified Version has been derived from a Modified
-Version made by someone other than you, you are nevertheless required
-to ensure that your Modified Version complies with the requirements of
-this license.
-
-(12) This license does not grant you the right to use any trademark,
-service mark, tradename, or logo of the Copyright Holder.
-
-(13) This license includes the non-exclusive, worldwide,
-free-of-charge patent license to make, have made, use, offer to sell,
-sell, import and otherwise transfer the Package with respect to any
-patent claims licensable by the Copyright Holder that are necessarily
-infringed by the Package. If you institute patent litigation
-(including a cross-claim or counterclaim) against any party alleging
-that the Package constitutes direct or contributory patent
-infringement, then this Artistic License to you shall terminate on the
-date that such litigation is filed.
-
-(14) Disclaimer of Warranty:
-THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
-IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
-LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
97 ext/nqp-rx/README
@@ -1,97 +0,0 @@
-=head1 NQP - Not Quite Perl (6)
-
-NQP is Copyright (C) 2009 by Patrick R. Michaud. See F<LICENSE>
-for licensing details.
-
-This is "Not Quite Perl" -- a compiler for quickly generating PIR
-routines from Perl6-like code. The key feature of NQP is that it's
-designed to be a very small compiler (as compared with, say, perl6
-or Rakudo) and is focused on being a high-level way to create
-transformers for Parrot (especially hll compilers). In addition,
-unlike Rakudo, NQP attempts to restrict itself to generating code
-that can run in Parrot without the existence of any NQP-specific
-runtime libraries.
-
-=head2 Building from source
-
-NQP comes bundled with Parrot, so if you have a recent Parrot
-distribution you likely also have a copy of NQP. Inside of a
-Parrot installation NQP is known as C<parrot-nqp>.
-
-To build NQP from source, you'll just need a C<make> utility
-and Perl 5.8 or newer. To automatically obtain and build Parrot
-you may also need a Git client.
-
-To obtain NQP directly from its repository:
-
- $ git clone git://github.com/perl6/nqp-rx.git
-
-If you don't have git installed, you can get a tarball or zip
-of NQP from github by visiting http://github.com/perl6/nqp-rx/tree/master
-and clicking "Download". Then unpack the tarball or zip.
-
-Once you have a copy of NQP, build it as follows:
-
- $ cd nqp-rx
- $ perl Configure.pl --gen-parrot
- $ make
-
-This will create a "nqp" or "nqp.exe" executable in the
-current (nqp-rx) directory. Programs can then be run from
-the build directory using a command like:
-
- $ ./nqp hello.pl
-
-The C<--gen-parrot> option above tells Configure.pl to automatically
-download and build the most appropriate version of Parrot into a
-local "parrot/" subdirectory, install that Parrot into the
-"parrot_install/" subdirectory, and use that for building NQP.
-It's okay to use the C<--gen-parrot> option on later invocations
-of Configure.pl; the configure system will re-build Parrot only
-if a newer version is needed for whatever version of Rakudo you're
-working with.
-
-You can use C<--parrot-config=/path/to/parrot_config> instead
-of C<--gen-parrot> to use an already installed Parrot for building
-NQP. This installed Parrot must include its development
-environment; typically this is done via Parrot's C<make install>
-target or by installing prebuilt C<parrot-devel> and/or C<libparrot-dev>
-packages. The version of the already installed Parrot must satisfy a
-minimum specified by the NQP being built -- Configure.pl will
-verify this for you. Released versions of NQP always build
-against the latest release of Parrot; checkouts of the HEAD revision
-from github often require a version of Parrot that is newer than
-the most recent Parrot monthly release.
-
-Once built, NQP's C<make install> target will install NQP
-and its libraries into the Parrot installation that was used to
-create it. Until this step is performed, the "nqp" executable
-created by C<make> above can only be reliably run from the root of
-NQP's build directory. After C<make install> is performed
-the executable can be run from any directory (as long as the
-Parrot installation that was used to create it remains intact).
-
-If the NQP compiler is invoked without an explicit script to
-run, it enters a small interactive mode that allows statements
-to be executed from the command line. Each line entered is treated
-as a separate compilation unit, however (which means that subroutines
-are preserved after they are defined, but variables are not).
-
-=head2 Differences from previous version of NQP
-
-* Sub declarations are now lexical ("my") by default, use
- "our sub xyz() { ... }" if you want package-scoped subroutines.
-
-* The PIR q<...>; construct is gone. Use Q:PIR or pir::opcode(...)
- instead.
-
-* The mainline code of modules is no longer tagged as ":load :init"
- by default. Use INIT { ... } for any code that you want to be
- run automatically at startup.
-
-* Cuddled else's are no longer valid Perl 6, 'else' requires a
- space after it.
-
-* Double-quoted strings now interpolate $-variables.
-
-
View
33 ext/nqp-rx/Rules.mak
@@ -1,33 +0,0 @@
-## XXX does not cover .includes of core .pasm files
-
-NQP_STAGE0_DIR = ext/nqp-rx/src/stage0
-
-$(LIBRARY_DIR)/Regex.pbc: $(NQP_STAGE0_DIR)/Regex-s0.pir $(PARROT)
- $(PARROT) -o $@ $(NQP_STAGE0_DIR)/Regex-s0.pir
-
-$(LIBRARY_DIR)/HLL.pbc: $(NQP_STAGE0_DIR)/HLL-s0.pir $(PARROT)
- $(PARROT) -o $@ $(NQP_STAGE0_DIR)/HLL-s0.pir
-
-$(LIBRARY_DIR)/P6Regex.pbc: $(NQP_STAGE0_DIR)/P6Regex-s0.pir $(PARROT)
- $(PARROT) -o $@ $(NQP_STAGE0_DIR)/P6Regex-s0.pir
-
-$(LIBRARY_DIR)/nqp-rx.pbc: $(NQP_STAGE0_DIR)/NQP-s0.pir $(PARROT)
- $(PARROT) -o $@ $(NQP_STAGE0_DIR)/NQP-s0.pir
-
-## eventually nqp should be able to generate .pbc files directly
-$(LIBRARY_DIR)/nqp-setting.pbc: $(NQP_STAGE0_DIR)/nqp-setting.nqp $(LIBRARY_DIR)/nqp-rx.pbc $(NQPRX_LIB_PBCS)
- $(PARROT) $(LIBRARY_DIR)/nqp-rx.pbc --target=pir -o $(NQP_STAGE0_DIR)/nqp-setting.pir $(NQP_STAGE0_DIR)/nqp-setting.nqp
- $(PARROT) -o $@ $(NQP_STAGE0_DIR)/nqp-setting.pir
-
-## TT #1398 - pbc_to_exe cannot generate a specified target file
-parrot-nqp.pbc : $(LIBRARY_DIR)/nqp-rx.pbc
- $(CP) $(LIBRARY_DIR)/nqp-rx.pbc $@
-
-$(NQP_RX) : $(NQPRX_LIB_PBCS) $(PBC_TO_EXE) parrot-nqp.pbc
- $(PBC_TO_EXE) parrot-nqp.pbc
-
-$(INSTALLABLENQP) : $(NQPRX_LIB_PBCS) src/install_config$(O) $(PBC_TO_EXE) parrot-nqp.pbc
- $(PBC_TO_EXE) parrot-nqp.pbc --install
-
-
-
View
70 ext/nqp-rx/STATUS
@@ -1,70 +0,0 @@
-2009-10-09:
-
-At the moment, nqp-rx is configured to build an executable called
-"p6regex", which is a Perl 6 regular expression compiler for Parrot.
-Yes, Parrot already has a Perl 6 regular expression compiler (PGE);
-this one is different in that it will be self-hosting and based on
-PAST/POST generation.
-
-Building the system is similar to building Rakudo:
-
- $ perl Configure.pl --gen-parrot
- $ make
-
-This builds a "p6regex" executable, which can be used to view
-the results of compiling various regular expressions. Like Rakudo,
-p6regex accepts --target=parse, --target=past, and --target=pir, to
-see the results of compiling various regular expressions. For example,
-
- $ ./p6regex --target=parse
- > abcde*f
-
-will display the parse tree for the regular expression "abcde*f". Similarly,
-
- $ ./p6regex --target=pir
- > abcde*f
-
-will display the PIR subroutine generated to match the regular
-expression "abcde*f".
-
-At the moment there's not an easy command-line tool for doing matches
-against the compiled regular expression; that should be coming soon
-as nqp-rx gets a little farther along.
-
-The test suite can be run via "make test" -- because the new regex
-engine is incomplete, we expect quite a few failures (which should
-diminish as we add new features to the project).
-
-The key files for the p6regex compiler are:
-
- src/Regex/P6Regex/Grammar.pm # regular expression parse grammar
- src/Regex/P6Regex/Actions.pm # actions to create PAST from parse
-
-
-Things that work (2009-10-15, 06h16 UTC):
-
-* bare literal strings
-* quantifiers *, +, ?, *:, +:, ?:, *?, +?, ??, *!, +!, ?!
-* dot
-* \d, \s, \w, \n, \D, \S, \W, \N
-* brackets for grouping
-* alternation (|| works, | cheats)
-* anchors ^, ^^, $, $$, <<, >>
-* backslash-quoted punctuation
-* #-comments (mostly)
-* obsolete backslash sequences \A \Z \z \Q
-* \b, \B, \e, \E, \f, \F, \h, \H, \r, \R, \t, \T, \v, \V
-* enumerated character lists <[ab0..9]>
-* character class compositions <+foo-bar+[xyz]>
-* quantified by numeric range
-* quantified by separator
-* capturing subrules
-* capturing subpatterns
-* capture aliases
-* cut rule
-* Match objects created lazily
-* built-in methods <alpha> <digit> <xdigit> <ws> <wb> etc.
-* :ignorecase
-* :sigspace
-* :ratchet
-* single-quoted literals (without quotes)
View
8,998 ext/nqp-rx/src/stage0/HLL-s0.pir
0 additions, 8,998 deletions not shown
View
28,382 ext/nqp-rx/src/stage0/NQP-s0.pir
0 additions, 28,382 deletions not shown
View
14,226 ext/nqp-rx/src/stage0/P6Regex-s0.pir
0 additions, 14,226 deletions not shown
View
3,885 ext/nqp-rx/src/stage0/Regex-s0.pir
@@ -1,3885 +0,0 @@
-#
-
-=head1 NAME
-
-Regex - Regex library
-
-=head1 DESCRIPTION
-
-This file brings together the various Regex modules needed for Regex.pbc .
-
-=cut
-
-### .include 'src/Regex/Cursor.pir'
-# Copyright (C) 2009, The Perl Foundation.
-#
-
-=head1 NAME
-
-Regex::Cursor - Regex Cursor nodes
-
-=head1 DESCRIPTION
-
-This file implements the Regex::Cursor class, used for managing regular
-expression control flow. Regex::Cursor is also a base class for
-grammars.
-
-=cut
-
-.include 'cclass.pasm'
-### .include 'src/Regex/constants.pir'
-.const int CURSOR_FAIL = -1
-.const int CURSOR_FAIL_GROUP = -2
-.const int CURSOR_FAIL_RULE = -3
-.const int CURSOR_FAIL_MATCH = -4
-
-.const int CURSOR_TYPE_SCAN = 1
-.const int CURSOR_TYPE_PEEK = 2
-
-.namespace ['Regex';'Cursor']
-
-.sub '' :anon :load :init
- load_bytecode 'P6object.pbc'
- .local pmc p6meta
- p6meta = new 'P6metaclass'
- $P0 = p6meta.'new_class'('Regex::Cursor', 'attr'=>'$!target $!from $!pos $!match $!names $!debug @!bstack @!cstack @!caparray &!regex')
- $P0 = box 0
- set_global '$!generation', $P0
- $P0 = new ['Boolean']
- assign $P0, 0
- set_global '$!FALSE', $P0
- $P0 = new ['Boolean']
- assign $P0, 1
- set_global '$!TRUE', $P0
- .return ()
-.end
-
-=head2 Methods
-
-=over 4
-
-=item new_match()
-
-A method that creates an empty Match object, by default of type
-C<Regex::Match>. This method can be overridden for generating HLL-specific
-Match objects.
-
-=cut
-
-.sub 'new_match' :method
- .local pmc match
- match = new ['Regex';'Match']
- .return (match)
-.end
-
-=item new_array()
-
-A method that creates an empty array object, by default of type
-C<ResizablePMCArray>. This method can be overridden for generating HLL-specific
-arrays for usage within Match objects.
-
-=cut
-
-.sub 'new_array' :method
- .local pmc arr
- arr = new ['ResizablePMCArray']
- .return (arr)
-.end
-
-=item MATCH()
-
-Return this cursor's current Match object, generating a new one
-for the Cursor if one hasn't been created yet.
-
-=cut
-
-.sub 'MATCH' :method
- .local pmc match
- match = getattribute self, '$!match'
- if null match goto match_make
- $P0 = get_global '$!TRUE'
- $I0 = issame match, $P0
- unless $I0 goto match_done
-
- # First, create a Match object and bind it
- match_make:
- match = self.'new_match'()
- setattribute self, '$!match', match
- setattribute match, '$!cursor', self
- .local pmc target, from, to
- target = getattribute self, '$!target'
- setattribute match, '$!target', target
- from = getattribute self, '$!from'
- setattribute match, '$!from', from
- to = getattribute self, '$!pos'
- setattribute match, '$!to', to
-
- # Create any arrayed subcaptures.
- .local pmc caparray, caparray_it, caphash
- caparray = getattribute self, '@!caparray'
- if null caparray goto caparray_done
- caparray_it = iter caparray
- caphash = new ['Hash']
- caparray_loop:
- unless caparray_it goto caparray_done
- .local string subname
- .local pmc arr
- .local int keyint
- subname = shift caparray_it
- arr = self.'new_array'()
- caphash[subname] = arr
- keyint = is_cclass .CCLASS_NUMERIC, subname, 0
- if keyint goto caparray_int
- match[subname] = arr
- goto caparray_loop
- caparray_int:
- $I0 = subname
- match[$I0] = arr
- goto caparray_loop
- caparray_done:
-
- # If it's not a successful match, or if there are
- # no saved subcursors, we're done.
- if to < from goto match_done
- .local pmc cstack, cstack_it
- cstack = getattribute self, '@!cstack'
- if null cstack goto cstack_done
- unless cstack goto cstack_done
- cstack_it = iter cstack
- cstack_loop:
- unless cstack_it goto cstack_done
- .local pmc subcur, submatch, names
- subcur = shift cstack_it
- $I0 = isa subcur, ['Regex';'Cursor']
- unless $I0 goto cstack_loop
- # If the subcursor isn't bound with a name, skip it
- names = getattribute subcur, '$!names'
- if null names goto cstack_loop
- submatch = subcur.'MATCH'()
- # See if we have multiple binds
- .local pmc names_it
- subname = names
- names_it = get_global '$!FALSE'
- $I0 = index subname, '='
- if $I0 < 0 goto cstack_subname
- names_it = split '=', subname
- cstack_subname_loop:
- subname = shift names_it
- cstack_subname:
- keyint = is_cclass .CCLASS_NUMERIC, subname, 0
- if null caparray goto cstack_bind
- $I0 = exists caphash[subname]
- unless $I0 goto cstack_bind
- if keyint goto cstack_array_int
- $P0 = match[subname]
- push $P0, submatch
- goto cstack_bind_done
- cstack_array_int:
- $I0 = subname
- $P0 = match[$I0]
- push $P0, submatch
- goto cstack_bind_done
- cstack_bind:
- if keyint goto cstack_bind_int
- match[subname] = submatch
- goto cstack_bind_done
- cstack_bind_int:
- $I0 = subname
- match[$I0] = submatch
- cstack_bind_done:
- if names_it goto cstack_subname_loop
- goto cstack_loop
- cstack_done:
-
- match_done:
- .return (match)
-.end
-
-
-=item parse(target [, 'rule'=>regex])
-
-Parse C<target> in the current grammar starting with C<regex>.
-If C<regex> is omitted, then use the C<TOP> rule for the grammar.
-
-=cut
-
-.sub 'parse' :method
- .param pmc target
- .param pmc regex :named('rule') :optional
- .param int has_regex :opt_flag
- .param pmc actions :named('actions') :optional
- .param int rxtrace :named('rxtrace') :optional
- .param pmc options :slurpy :named
-
- if has_regex goto have_regex
- regex = box 'TOP'
- have_regex:
- $I0 = isa regex, ['String']
- unless $I0 goto regex_done
- $S0 = regex
- regex = find_method self, $S0
- regex_done:
-
- .lex '$*ACTIONS', actions
-
- .local pmc cur, match
- cur = self.'!cursor_init'(target, options :flat :named)
- unless rxtrace goto rxtrace_done
- cur.'DEBUG'()
- rxtrace_done:
- cur = cur.regex()
- match = cur.'MATCH'()
- .return (match)
-.end
-
-
-=item next()
-
-Return the next match from a successful Cursor.
-
-=cut
-
-.sub 'next' :method
- .local pmc cur, match
- cur = self.'!cursor_next'()
- match = cur.'MATCH'()
- .return (match)
-.end
-
-
-=item pos()
-
-Return the cursor's current position.
-
-=cut
-
-.sub 'pos' :method
- $P0 = getattribute self, '$!pos'
- .return ($P0)
-.end
-
-
-=item from()
-
-Return the cursor's from position.
-
-=cut
-
-.sub 'from' :method
- $P0 = getattribute self, '$!from'
- .return ($P0)
-.end
-
-=back
-
-=head2 Private methods
-
-=over 4
-
-=item !cursor_init(target)
-
-Create a new cursor for matching C<target>.
-
-=cut
-
-.sub '!cursor_init' :method
- .param string target
- .param int pos :named('p') :optional
- .param int has_pos :opt_flag
- .param int cont :named('c') :optional
- .param int has_cont :opt_flag
-
- .local pmc parrotclass, cur
- $P0 = self.'HOW'()
- parrotclass = getattribute $P0, 'parrotclass'
- cur = new parrotclass
-
- $P0 = box target
- setattribute cur, '$!target', $P0
-
- if has_cont goto cursor_cont
- $P0 = box pos
- setattribute cur, '$!from', $P0
- $P0 = box pos
- setattribute cur, '$!pos', $P0
- goto cursor_done
- cursor_cont:
- $P0 = box CURSOR_FAIL
- setattribute cur, '$!from', $P0
- $P0 = box cont
- setattribute cur, '$!pos', $P0
- cursor_done:
-
- .return (cur)
-.end
-
-=item !cursor_start([lang])
-
-Create and initialize a new cursor from C<self>. If C<lang> is
-provided, then the new cursor has the same type as lang.
-
-=cut
-
-.sub '!cursor_start' :method
- .param pmc lang :optional
- .param int has_lang :opt_flag
-
- if has_lang goto have_lang
- lang = self
- have_lang:
-
- .local pmc parrotclass, cur
- $P0 = lang.'HOW'()
- parrotclass = getattribute $P0, 'parrotclass'
- cur = new parrotclass
-
- .local pmc regex
- regex = getattribute self, '&!regex'
- unless null regex goto cursor_restart
-
- .local pmc from, target, debug
-
- from = getattribute self, '$!pos'
- setattribute cur, '$!from', from
- setattribute cur, '$!pos', from
-
- target = getattribute self, '$!target'
- setattribute cur, '$!target', target
- debug = getattribute self, '$!debug'
- setattribute cur, '$!debug', debug
-
- .return (cur, from, target, 0)
-
- cursor_restart:
- .local pmc pos, cstack, bstack
- from = getattribute self, '$!from'
- target = getattribute self, '$!target'
- debug = getattribute self, '$!debug'
- cstack = getattribute self, '@!cstack'
- bstack = getattribute self, '@!bstack'
- pos = box CURSOR_FAIL
-
- setattribute cur, '$!from', from
- setattribute cur, '$!pos', pos
- setattribute cur, '$!target', target
- setattribute cur, '$!debug', debug
- if null cstack goto cstack_done
- cstack = clone cstack
- setattribute cur, '@!cstack', cstack
- cstack_done:
- if null bstack goto bstack_done
- bstack = clone bstack
- setattribute cur, '@!bstack', bstack
- bstack_done:
- .return (cur, from, target, 1)
-.end
-
-
-=item !cursor_fail(pos)
-
-Permanently fail this cursor.
-
-=cut
-
-.sub '!cursor_fail' :method
- .local pmc pos
- pos = box CURSOR_FAIL_RULE
- setattribute self, '$!pos', pos
- null $P0
- setattribute self, '$!match', $P0
- setattribute self, '@!bstack', $P0
- setattribute self, '@!cstack', $P0
-.end
-
-
-=item !cursor_pass(pos, name)
-
-Set the Cursor as passing at C<pos>; calling any reduction action
-C<name> associated with the cursor. This method simply sets
-C<$!match> to a boolean true value to indicate the regex was
-successful; the C<MATCH> method above replaces this boolean true
-with a "real" Match object when requested.
-
-=cut
-
-.sub '!cursor_pass' :method
- .param pmc pos
- .param string name
-
- setattribute self, '$!pos', pos
- .local pmc match
- match = get_global '$!TRUE'
- setattribute self, '$!match', match
- unless name goto done
- self.'!reduce'(name)
- done:
- .return (self)
-.end
-
-
-=item !cursor_backtrack()
-
-Configure this cursor for backtracking via C<!cursor_next>.
-
-=cut
-
-.sub '!cursor_backtrack' :method
- $P0 = getinterp
- $P1 = $P0['sub';1]
- setattribute self, '&!regex', $P1
-.end
-
-
-=item !cursor_next()
-
-Continue a regex match from where the current cursor left off.
-
-=cut
-
-.sub '!cursor_next' :method
- .local pmc regex, cur
- regex = getattribute self, '&!regex'
- if null regex goto fail
- cur = self.regex()
- .return (cur)
- fail:
- cur = self.'!cursor_start'()
- cur.'!cursor_fail'()
- .return (cur)
-.end
-
-
-=item !cursor_caparray(caparray :slurpy)
-
-Set the list of subcaptures that produce arrays to C<caparray>.
-
-=cut
-
-.sub '!cursor_caparray' :method
- .param pmc caparray :slurpy
- setattribute self, '@!caparray', caparray
-.end
-
-
-=item !cursor_names(names)
-
-Set the Cursor's name (for binding) to C<names>.
-
-=cut
-
-.sub '!cursor_names' :method
- .param pmc names
- setattribute self, '$!names', names
-.end
-
-
-=item !cursor_pos(pos)
-
-Set the cursor's position to C<pos>.
-
-=cut
-
-.sub '!cursor_pos' :method
- .param pmc pos
- setattribute self, '$!pos', pos
-.end
-
-
-=item !cursor_debug(args :slurpy)
-
-Log a debug message.
-
-=cut
-
-.sub '!cursor_debug' :method
- .param string tag
- .param pmc args :slurpy
- $P0 = getattribute self, '$!debug'
- if null $P0 goto done
- unless $P0 goto done
- .local pmc fmt, from, pos, orig, line
- fmt = new ['ResizablePMCArray']
- from = getattribute self, '$!from'
- orig = getattribute self, '$!target'
- $P0 = get_hll_global ['HLL'], 'Compiler'
- line = $P0.'lineof'(orig, from, 'cache'=>1)
-
- $P0 = getinterp
- $P1 = $P0.'stderr_handle'()
-
- $N0 = time
- push fmt, $N0
- push fmt, from
- push fmt, line
- push fmt, tag
- $S0 = sprintf "%.6f %d/%d %-8s ", fmt
- print $P1, $S0
- $S0 = join '', args
- print $P1, $S0
- print $P1, "\n"
- done:
- .return (self)
-.end
-
-
-=item !mark_push(rep, pos, mark)
-
-Push a new backtracking point onto the cursor with the given
-C<rep>, C<pos>, and backtracking C<mark>. (The C<mark> is typically
-the address of a label to branch to when backtracking occurs.)
-
-=cut
-
-.sub '!mark_push' :method
- .param int rep
- .param int pos
- .param int mark
- .param pmc subcur :optional
- .param int has_subcur :opt_flag
-
- # cptr contains the desired number of elements in the cstack
- .local int cptr
- cptr = 0
-
- # Initialize bstack if needed, and set cptr to be the cstack
- # size requested by the top frame.
- .local pmc bstack
- bstack = getattribute self, '@!bstack'
- if null bstack goto bstack_new
- unless bstack goto bstack_done
- $I0 = elements bstack
- dec $I0
- cptr = bstack[$I0]
- goto bstack_done
- bstack_new:
- bstack = new ['ResizableIntegerArray']
- setattribute self, '@!bstack', bstack
- bstack_done:
-
- # If a new subcursor is being pushed, then save it in cstack
- # and change cptr to include the new subcursor. Also clear
- # any existing match object, as we may have just changed the
- # match state.
- unless has_subcur goto subcur_done
- null $P0
- setattribute self, '$!match', $P0
- .local pmc cstack
- cstack = getattribute self, '@!cstack'
- unless null cstack goto have_cstack
- cstack = new ['ResizablePMCArray']
- setattribute self, '@!cstack', cstack
- have_cstack:
- cstack[cptr] = subcur
- inc cptr
- subcur_done:
-
- # Save our mark frame information.
- push bstack, mark
- push bstack, pos
- push bstack, rep
- push bstack, cptr
-.end
-
-
-=item !mark_peek(mark)
-
-Return information about the latest frame for C<mark>.
-If C<mark> is zero, return information about the latest frame.
-
-=cut
-
-.sub '!mark_peek' :method
- .param int tomark
-
- .local pmc bstack
- bstack = getattribute self, '@!bstack'
- if null bstack goto no_mark
- unless bstack goto no_mark
-
- .local int bptr
- bptr = elements bstack
-
- bptr_loop:
- bptr = bptr - 4
- if bptr < 0 goto no_mark
- .local int rep, pos, mark, cptr
- mark = bstack[bptr]
- unless tomark goto bptr_done
- unless mark == tomark goto bptr_loop
- bptr_done:
- $I0 = bptr + 1
- pos = bstack[$I0]
- inc $I0
- rep = bstack[$I0]
- inc $I0
- cptr = bstack[$I0]
- .return (rep, pos, mark, bptr, bstack, cptr)
-
- no_mark:
- .return (0, CURSOR_FAIL_GROUP, 0, 0, bstack, 0)
-.end
-
-
-=item !mark_fail(tomark)
-
-Remove the most recent C<mark> and backtrack the cursor to the
-point given by that mark. If C<mark> is zero, then
-backtracks the most recent mark. Returns the backtracked
-values of repetition count, cursor position, and mark (address).
-
-=cut
-
-.sub '!mark_fail' :method
- .param int mark
-
- # Get the frame information for C<mark>.
- .local int rep, pos, mark, bptr, cptr
- .local pmc bstack
- (rep, pos, mark, bptr, bstack, cptr) = self.'!mark_peek'(mark)
-
- # clear any existing Match object
- null $P0
- setattribute self, '$!match', $P0
-
- .local pmc subcur
- null subcur
-
- # If there's no bstack, there's nothing else to do.
- if null bstack goto done
-
- # If there's a subcursor associated with this mark, return it.
- unless cptr > 0 goto cstack_done
- .local pmc cstack
- cstack = getattribute self, '@!cstack'
- dec cptr
- subcur = cstack[cptr]
- # Set the cstack to the size requested by the soon-to-be-top mark frame.
- unless bptr > 0 goto cstack_zero
- $I0 = bptr - 1
- $I0 = bstack[$I0]
- assign cstack, $I0
- goto cstack_done
- cstack_zero:
- assign cstack, 0
- cstack_done:
-
- # Pop the current mark frame and all above it.
- assign bstack, bptr
-
- done:
- .return (rep, pos, mark, subcur)
-.end
-
-
-=item !mark_commit(mark)
-
-Like C<!mark_fail> above this backtracks the cursor to C<mark>
-(releasing any intermediate marks), but preserves the current
-capture states.
-
-=cut
-
-.sub '!mark_commit' :method
- .param int mark
-
- # find mark
- .local int rep, pos, mark, bptr, cptr
- .local pmc bstack
- (rep, pos, mark, bptr, bstack) = self.'!mark_peek'(mark)
-
- # get current cstack size into cptr
- if null bstack goto done
- unless bstack goto done
- $I0 = elements bstack
- dec $I0
- cptr = bstack[$I0]
-
- # Pop the mark frame and everything above it.
- assign bstack, bptr
-
- # If we don't need to hold any cstack information, we're done.
- unless cptr > 0 goto done
-
- # If the top frame is an auto-fail frame, (re)use it to hold
- # our needed cptr, otherwise create a new auto-fail frame to do it.
- unless bptr > 0 goto cstack_push
- $I0 = bptr - 3 # pos is at top-3
- $I1 = bstack[$I0]
- unless $I1 < 0 goto cstack_push
- $I0 = bptr - 1 # cptr is at top-1
- bstack[$I0] = cptr
- goto done
- cstack_push:
- push bstack, 0 # mark
- push bstack, CURSOR_FAIL # pos
- push bstack, 0 # rep
- push bstack, cptr # cptr
-
- done:
- .return (rep, pos, mark)
-.end
-
-
-=item !reduce(name [, key] [, match])
-
-Perform any action associated with the current regex match.
-
-=cut
-
-.sub '!reduce' :method
- .param string name
- .param string key :optional
- .param int has_key :opt_flag
- .param pmc match :optional
- .param int has_match :opt_flag
- .local pmc actions
- actions = find_dynamic_lex '$*ACTIONS'
- if null actions goto actions_done
- $I0 = can actions, name
- unless $I0 goto actions_done
- if has_match goto match_done
- match = self.'MATCH'()
- match_done:
- if has_key goto actions_key
- actions.name(match)
- goto actions_done
- actions_key:
- .tailcall actions.name(match, key)
- actions_done:
- .return ()
-.end
-
-
-=item !BACKREF(name)
-
-Match the backreference given by C<name>.
-
-=cut
-
-.sub '!BACKREF' :method
- .param string name
- .local pmc cur
- .local int pos, eos
- .local string tgt
- (cur, pos, tgt) = self.'!cursor_start'()
-
- # search the cursor cstack for the latest occurrence of C<name>
- .local pmc cstack
- cstack = getattribute self, '@!cstack'
- if null cstack goto pass
- .local int cstack_it
- cstack_it = elements cstack
- cstack_loop:
- dec cstack_it
- unless cstack_it >= 0 goto pass
- .local pmc subcur
- subcur = cstack[cstack_it]
- $P0 = getattribute subcur, '$!names'
- if null $P0 goto cstack_loop
- $S0 = $P0
- if name != $S0 goto cstack_loop
- # we found a matching subcursor, get the literal it matched
- cstack_done:
- .local int litlen
- .local string litstr
- $I1 = subcur.'pos'()
- $I0 = subcur.'from'()
- litlen = $I1 - $I0
- litstr = substr tgt, $I0, litlen
- # now test the literal against our target
- $S0 = substr tgt, pos, litlen
- unless $S0 == litstr goto fail
- pos += litlen
- pass:
- cur.'!cursor_pass'(pos, '')
- fail:
- .return (cur)
-.end
-
-
-=item !INTERPOLATE(var [, convert])
-
-Perform regex interpolation on C<var>. If C<var> is a
-regex (sub), it is used directly, otherwise it is used
-for a string literal match. If C<var> is an array,
-then all of the elements of C<var> are considered,
-and the longest match is returned.
-
-=cut
-
-.sub '!INTERPOLATE' :method
- .param pmc var
-
- .local pmc cur
- .local int pos, eos
- .local string tgt
-
- $I0 = does var, 'array'
- if $I0 goto var_array
-
- var_scalar:
- $I0 = does var, 'invokable'
- if $I0 goto var_sub
-
- var_string:
- (cur, pos, tgt) = self.'!cursor_start'()
- eos = length tgt
- $S0 = var
- $I0 = length $S0
- $I1 = pos + $I0
- if $I1 > eos goto string_fail
- $S1 = substr tgt, pos, $I0
- if $S0 != $S1 goto string_fail
- pos += $I0
- string_pass:
- cur.'!cursor_pass'(pos, '')
- string_fail:
- .return (cur)
-
- var_sub:
- cur = var(self)
- .return (cur)
-
- var_array:
- (cur, pos, tgt) = self.'!cursor_start'()
- eos = length tgt
- .local pmc var_it, elem
- .local int maxlen
- var_it = iter var
- maxlen = -1
- array_loop:
- unless var_it goto array_done
- elem = shift var_it
- $I0 = does elem, 'invokable'
- if $I0 goto array_sub
- array_string:
- $S0 = elem
- $I0 = length $S0
- if $I0 <= maxlen goto array_loop
- $I1 = pos + $I0
- if $I1 > eos goto array_loop
- $S1 = substr tgt, pos, $I0
- if $S0 != $S1 goto array_loop
- maxlen = $I0
- goto array_loop
- array_sub:
- $P0 = elem(self)
- unless $P0 goto array_loop
- $I0 = $P0.'pos'()
- $I0 -= pos
- if $I0 <= maxlen goto array_loop
- maxlen = $I0
- goto array_loop
- array_done:
- if maxlen < 0 goto array_fail
- $I0 = pos + maxlen
- cur.'!cursor_pass'($I0, '')
- array_fail:
- .return (cur)
-.end
-
-
-=item !INTERPOLATE_REGEX(var)
-
-Same as C<!INTERPOLATE> above, except that any non-regex values
-are first compiled to regexes prior to being matched.
-
-=cut
-
-.sub '!INTERPOLATE_REGEX' :method
- .param pmc var
-
- $I0 = does var, 'invokable'
- if $I0 goto done
-
- .local pmc p6regex
- p6regex = compreg 'Regex::P6Regex'
-
- $I0 = does var, 'array'
- if $I0 goto var_array
- var = p6regex.'compile'(var)
- goto done
-
- var_array:
- .local pmc var_it, elem
- var_it = iter var
- var = new ['ResizablePMCArray']
- var_loop:
- unless var_it goto done
- elem = shift var_it
- $I0 = does elem, 'invokable'
- if $I0 goto var_next
- elem = p6regex.'compile'(elem)
- var_next:
- push var, elem
- goto var_loop
-
- done:
- .tailcall self.'!INTERPOLATE'(var)
-.end
-
-
-=back
-
-=head2 Vtable functions
-
-=over 4
-
-=item get_bool
-
-=cut
-
-.sub '' :vtable('get_bool') :method
- .local pmc match
- match = getattribute self, '$!match'
- if null match goto false
- $I0 = istrue match
- .return ($I0)
- false:
- .return (0)
-.end
-
-=back
-
-=head1 AUTHORS
-
-Patrick Michaud <pmichaud@pobox.com> is the author and maintainer.
-
-=cut
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
-### .include 'src/Regex/Cursor-builtins.pir'
-# Copyright (C) 2009, The Perl Foundation.
-#
-
-=head1 NAME
-
-Regex::Cursor-builtins - builtin regexes for Cursor objects
-
-=cut
-
-.include 'cclass.pasm'
-
-.namespace ['Regex';'Cursor']
-
-.sub 'before' :method
- .param pmc regex :optional
- .local pmc cur
- .local int pos
- (cur, pos) = self.'!cursor_start'()
- if null regex goto fail
- $P0 = cur.regex()
- unless $P0 goto fail
- cur.'!cursor_pass'(pos, 'before')
- fail:
- .return (cur)
-.end
-
-
-.sub 'ident' :method
- .local pmc cur
- .local int pos, eos
- .local string tgt
- (cur, pos, tgt) = self.'!cursor_start'()
- eos = length tgt
- $S0 = substr tgt, pos, 1
- if $S0 == '_' goto ident_1
- $I0 = is_cclass .CCLASS_ALPHABETIC, tgt, pos
- unless $I0 goto fail
- ident_1:
- pos = find_not_cclass .CCLASS_WORD, tgt, pos, eos
- cur.'!cursor_pass'(pos, 'ident')
- fail:
- .return (cur)
-.end
-
-.sub 'wb' :method
- .local pmc cur
- .local int pos, eos
- .local string tgt
- (cur, pos, tgt) = self.'!cursor_start'()
- if pos == 0 goto pass
- eos = length tgt
- if pos == eos goto pass
- $I0 = pos - 1
- $I1 = is_cclass .CCLASS_WORD, tgt, $I0
- $I2 = is_cclass .CCLASS_WORD, tgt, pos
- if $I1 == $I2 goto fail
- pass:
- cur.'!cursor_pass'(pos, 'wb')
- fail:
- .return (cur)
-.end
-
-.sub 'ww' :method
- .local pmc cur
- .local int pos, eos
- .local string tgt
- (cur, pos, tgt) = self.'!cursor_start'()
- .local pmc debug
- debug = getattribute cur, '$!debug'
- if null debug goto debug_1
- cur.'!cursor_debug'('START', 'ww')
- debug_1:
- if pos == 0 goto fail
- eos = length tgt
- if pos == eos goto fail
- $I0 = is_cclass .CCLASS_WORD, tgt, pos
- unless $I0 goto fail
- $I1 = pos - 1
- $I0 = is_cclass .CCLASS_WORD, tgt, $I1
- unless $I0 goto fail
- pass:
- cur.'!cursor_pass'(pos, 'ww')
- if null debug goto done
- cur.'!cursor_debug'('PASS', 'ww')
- goto done
- fail:
- if null debug goto done
- cur.'!cursor_debug'('FAIL', 'ww')
- done:
- .return (cur)
-.end
-
-.sub 'ws' :method
- .local pmc cur
- .local int pos, eos
- .local string tgt
- (cur, pos, tgt) = self.'!cursor_start'()
- eos = length tgt
- if pos >= eos goto pass
- if pos == 0 goto ws_scan
- $I0 = is_cclass .CCLASS_WORD, tgt, pos
- unless $I0 goto ws_scan
- $I1 = pos - 1
- $I0 = is_cclass .CCLASS_WORD, tgt, $I1
- if $I0 goto fail
- ws_scan:
- pos = find_not_cclass .CCLASS_WHITESPACE, tgt, pos, eos
- pass:
- cur.'!cursor_pass'(pos, 'ws')
- fail:
- .return (cur)
-.end
-
-.sub '!cclass' :anon
- .param pmc self
- .param string name
- .param int cclass
- .local pmc cur
- .local int pos
- .local string tgt
- (cur, pos, tgt) = self.'!cursor_start'()
- .local pmc debug
- debug = getattribute cur, '$!debug'
- if null debug goto debug_1
- cur.'!cursor_debug'('START', name)
- debug_1:
- $I0 = is_cclass cclass, tgt, pos
- unless $I0 goto fail
- inc pos
- pass:
- cur.'!cursor_pass'(pos, name)
- if null debug goto done
- cur.'!cursor_debug'('PASS', name)
- goto done
- fail:
- if null debug goto done
- cur.'!cursor_debug'('FAIL', name)
- done:
- .return (cur)
-.end
-
-.sub 'alpha' :method
- .local pmc cur
- .local int pos
- .local string tgt
- (cur, pos, tgt) = self.'!cursor_start'()
- .local pmc debug
- debug = getattribute cur, '$!debug'
- if null debug goto debug_1
- cur.'!cursor_debug'('START', 'alpha')
- debug_1:
- $I0 = is_cclass .CCLASS_ALPHABETIC, tgt, pos