File: Strict.pm

package info (click to toggle)
libtoml-parser-perl 0.91-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,716 kB
  • sloc: perl: 664; sh: 4; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package TOML::Parser::Tokenizer::Strict;
use 5.010000;
use strict;
use warnings;

use parent qw/TOML::Parser::Tokenizer/;
BEGIN { import TOML::Parser::Tokenizer qw/:constant/ }

sub grammar_regexp {
    my $grammar_regexp = {%{ shift->SUPER::grammar_regexp() }};
    $grammar_regexp->{table}                 = {%{ $grammar_regexp->{table} }};
    $grammar_regexp->{array_of_table}        = {%{ $grammar_regexp->{array_of_table} }};
    $grammar_regexp->{table}->{key}          = qr{(?:"(.*?)(?<!(?<!\\)\\)"|([A-Za-z0-9_-]+))};
    $grammar_regexp->{array_of_table}->{key} = qr{(?:"(.*?)(?<!(?<!\\)\\)"|([A-Za-z0-9_-]+))};
    $grammar_regexp->{key}                   = qr{(?:"(.*?)(?<!(?<!\\)\\)"|([A-Za-z0-9_-]+))\s*=};
    return $grammar_regexp;
}

1;
__END__