Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d0eb5328c1
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 76 lines (56 sloc) 1.408 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
=head1 TITLE

parse.pir - Parsing support subroutines for [expr]

=cut

.sub 'invalid_octal'
    .param pmc mob
    .param pmc adverbs :named :slurpy

    $S0 = mob
    $S0 = '0' . $S0
    $S0 = 'expected integer but got "' . $S0
    $S0 = $S0 . '" (looks like invalid octal number)'

    die $S0
.end

.sub 'unknown_math_function'
    .param pmc mob
    .param pmc adverbs :named :slurpy

    $S0 = mob[0]
    $S0 = 'unknown math function "' . $S0
    $S0 = $S0 . '"'

    die $S0
.end

.sub 'error'
    .param pmc mob
    .param string msg
    .param pmc adverbs :named :slurpy

    die msg
.end

.sub 'syntax_error'
    .param pmc mob
    .param string msg
    .param pmc adverbs :named :slurpy

    .local pmc target
    target = getattribute mob, '$.target'

    $S0 = target
    $S0 = 'syntax error in expression "' . $S0
    $S0 .= '": '
    $S0 .= msg

    die $S0
.end

.sub 'syntax_error_variable_or_function'
    .param pmc mob
    .param pmc adverbs :named :slurpy

    .local string target
    $P0 = getattribute mob, '$.target'
    target = $P0

    .local string msg
    msg = 'the word "'
    msg .= target
    msg .= '" requires a preceding $ if '
    msg .= "it's a variable or function arguments if it's a function"

    syntax_error(mob, msg, 'adverbs' => adverbs)
.end

# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
Something went wrong with that request. Please try again.