| 1 | # RDF::Trine::Parser::Turtle::Constants | ||
| 2 | # ----------------------------------------------------------------------------- | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | RDF::Trine::Parser::Turtle::Constants - Constant definitions for use in parsing Turtle, TriG, and N-Triples | ||
| 7 | |||
| 8 | =head1 VERSION | ||
| 9 | |||
| 10 | This document describes RDF::Trine::Parser::Turtle::Constants version 1.019 | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | use RDF::Trine::Parser::Constants; | ||
| 15 | |||
| 16 | =head1 METHODS | ||
| 17 | |||
| 18 | =over 4 | ||
| 19 | |||
| 20 | =cut | ||
| 21 | |||
| 22 | package RDF::Trine::Parser::Turtle::Constants; | ||
| 23 | |||
| 24 | 68 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 68 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | 68 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | |||
| 28 | 68 | our $VERSION; | |
| 29 | 68 | our @EXPORT; | |
| 30 | 68 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | 68 | $VERSION = '1.019'; | |
| 32 | 68 | @EXPORT = qw( | |
| 33 | LBRACKET | ||
| 34 | RBRACKET | ||
| 35 | LPAREN | ||
| 36 | RPAREN | ||
| 37 | DOT | ||
| 38 | SEMICOLON | ||
| 39 | COMMA | ||
| 40 | HATHAT | ||
| 41 | A | ||
| 42 | BOOLEAN | ||
| 43 | PREFIXNAME | ||
| 44 | IRI | ||
| 45 | BNODE | ||
| 46 | DOUBLE | ||
| 47 | DECIMAL | ||
| 48 | INTEGER | ||
| 49 | WS | ||
| 50 | COMMENT | ||
| 51 | STRING3D | ||
| 52 | STRING3S | ||
| 53 | STRING1D | ||
| 54 | STRING1S | ||
| 55 | BASE | ||
| 56 | PREFIX | ||
| 57 | SPARQLBASE | ||
| 58 | SPARQLPREFIX | ||
| 59 | LANG | ||
| 60 | LBRACE | ||
| 61 | RBRACE | ||
| 62 | EQUALS | ||
| 63 | decrypt_constant | ||
| 64 | ) | ||
| 65 | }; | ||
| 66 | 68 | ▶ | use base 'Exporter'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 67 | |||
| 68 | { | ||
| 69 | 68 | my %mapping; | |
| 70 | 68 | my %reverse; | |
| 71 | 68 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||
| 72 | 68 | my $cx = 0; | |
| 73 | 68 | foreach my $name (grep { $_ ne 'decrypt_constant' } @EXPORT) { | |
| 74 | 2040 | my $value = ++$cx; | |
| 75 | 2040 | $reverse{ $value } = $name; | |
| 76 | 2040 | $mapping{ $name } = $value; | |
| 77 | } | ||
| 78 | } | ||
| 79 | 68 | ▶ | use constant +{ %mapping }; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 80 | |||
| 81 | =item C<< decrypt_constant ( $type ) >> | ||
| 82 | |||
| 83 | Returns the token name for the given toke type. | ||
| 84 | |||
| 85 | =cut | ||
| 86 | |||
| 87 | 68 | ▶ | sub decrypt_constant { my $num = +shift; $reverse{$num} } |
|
Subroutine
decrypt_constant: called CC=1 SCAR=0.0
Pod
documented
| |||
| 88 | 68 | }; | |
| 89 | |||
| 90 | 68 | 1; | |
| 91 | |||
| 92 | __END__ | ||