Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix lookups of meta-objects in regex library.
  • Loading branch information
jnthn committed Apr 27, 2011
1 parent 74ac547 commit 835b51e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/Regex/Cursor.pir
Expand Up @@ -40,7 +40,9 @@ grammars.

# Build meta-object and store it in the namespace.
.local pmc type_obj, how, NQPClassHOW
get_hll_global NQPClassHOW, "NQPClassHOW"
$P0 = find_lex "EXPORTHOW"
$P0 = get_who $P0
NQPClassHOW = $P0["class"]
type_obj = NQPClassHOW."new_type"("Cursor" :named("name"))
RegexWHO["Cursor"] = type_obj
set_global "$?CLASS", type_obj
Expand Down Expand Up @@ -165,7 +167,9 @@ grammars.

# Add attributes.
.local pmc NQPAttribute, int_type, attr
NQPAttribute = get_hll_global "NQPAttribute"
$P0 = find_lex "EXPORTHOW"
$P0 = get_who $P0
NQPAttribute = $P0["class-attr"]
int_type = find_lex "int"
attr = NQPAttribute."new"("$!target" :named("name"))
how."add_attribute"(type_obj, attr)
Expand Down
8 changes: 6 additions & 2 deletions src/Regex/Match.pir
Expand Up @@ -26,7 +26,9 @@ This file implements Match objects for the regex engine.

# Build meta-object and store it in the namespace.
.local pmc type_obj, how, NQPClassHOW
get_hll_global NQPClassHOW, "NQPClassHOW"
$P0 = find_lex "EXPORTHOW"
$P0 = get_who $P0
NQPClassHOW = $P0["class"]
type_obj = NQPClassHOW."new_type"("Match" :named("name"))
RegexWHO["Match"] = type_obj
set_global "$?CLASS", type_obj
Expand Down Expand Up @@ -80,7 +82,9 @@ This file implements Match objects for the regex engine.

# Add attributes.
.local pmc NQPAttribute, int_type, attr
NQPAttribute = get_hll_global "NQPAttribute"
$P0 = find_lex "EXPORTHOW"
$P0 = get_who $P0
NQPAttribute = $P0["class-attr"]
int_type = find_lex "int"

attr = NQPAttribute.'new'('$!from' :named('name'), int_type :named('type'))
Expand Down
8 changes: 6 additions & 2 deletions src/Regex/Method.pir
Expand Up @@ -24,7 +24,9 @@ containers for Regex subs that need .ACCEPTS and other regex attributes.

# Build Regex::Method meta-object and store it in the namespace.
.local pmc method_type_obj, method_how, NQPClassHOW
get_hll_global NQPClassHOW, "NQPClassHOW"
$P0 = find_lex "EXPORTHOW"
$P0 = get_who $P0
NQPClassHOW = $P0["class"]
method_type_obj = NQPClassHOW."new_type"("Method" :named("name"))
RegexWHO["Method"] = method_type_obj
set_global "$?CLASS", method_type_obj
Expand All @@ -40,7 +42,9 @@ containers for Regex subs that need .ACCEPTS and other regex attributes.

# Add attribute.
.local pmc NQPAttribute, attr
NQPAttribute = get_hll_global "NQPAttribute"
$P0 = find_lex "EXPORTHOW"
$P0 = get_who $P0
NQPAttribute = $P0["class-attr"]
attr = NQPAttribute.'new'('$!code' :named('name'))
method_how.'add_attribute'(method_type_obj, attr)

Expand Down

0 comments on commit 835b51e

Please sign in to comment.