Permalink
Browse files

[pge]: p5regex compiler now throws exception upon parse error

git-svn-id: https://svn.parrot.org/parrot/trunk@16530 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 2d0330e commit abb2d7442cb3f6da96597a229873369f697384e9 @particle particle committed Jan 9, 2007
Showing with 16 additions and 2 deletions.
  1. +16 −2 compilers/pge/PGE/P5Regex.pir
View
18 compilers/pge/PGE/P5Regex.pir
@@ -106,8 +106,22 @@
.param pmc mob
.param int pos
.param string message
- print message
- exit 1
+ $P0 = getattribute mob, '$.pos'
+ $P0 = pos
+ $P0 = new .Exception
+ $S0 = 'p5regex parse error: '
+ $S0 .= message
+ $S0 .= ' at offset '
+ $S1 = pos
+ $S0 .= $S1
+ $S0 .= ", found '"
+ $P1 = getattribute mob, '$.target'
+ $S1 = $P1
+ $S1 = substr $S1, pos, 1
+ $S0 .= $S1
+ $S0 .= "'"
+ $P0['_message'] = $S0
+ throw $P0
.return ()
.end

0 comments on commit abb2d74

Please sign in to comment.