| 1 | package Regexp::MultiLanguage::JavaScript; | ||
| 2 | |||
| 3 | use base qw(Regexp::MultiLanguage::BaseDialect); | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Regexp::MultiLanguage::JavaScript - JavaScript dialect for Regexp::MultiLanguage. | ||
| 10 | |||
| 11 | =head1 VERSION | ||
| 12 | |||
| 13 | Version 0.03 | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | our $VERSION = 0.03; | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | This module should not be used directly. Please read the documentation | ||
| 22 | for L<Regexp::MultiLanguage> | ||
| 23 | |||
| 24 | =cut | ||
| 25 | |||
| 26 | sub wrap { | ||
| 27 | return $_[1]; | ||
| 28 | } | ||
| 29 | |||
| 30 | sub match_regex { | ||
| 31 | my ($this, $regex) = @_; | ||
| 32 | |||
| 33 | if ( $regex =~ /^m/ ) { | ||
| 34 | $regex = substr $regex, 1; | ||
| 35 | } | ||
| 36 | |||
| 37 | return "(value.match($regex))"; | ||
| 38 | } | ||
| 39 | |||
| 40 | sub comment_start { | ||
| 41 | return '//'; | ||
| 42 | } | ||
| 43 | |||
| 44 | sub make_function { | ||
| 45 | my ($this,$name,$expr) = @_; | ||
| 46 | my $prefix = $this->{'prefix'}; | ||
| 47 | return "function $prefix$name(value) { return $expr }\n"; | ||
| 48 | } | ||
| 49 | |||
| 50 | sub function_call { | ||
| 51 | my ($this,$name) = @_; | ||
| 52 | my $prefix = $this->{'prefix'}; | ||
| 53 | return "$prefix$name( value )"; | ||
| 54 | } | ||
| 55 | |||
| 56 | =head1 AUTHOR | ||
| 57 | |||
| 58 | Robby Walker, robwalker@cpan.org | ||
| 59 | |||
| 60 | =head1 COPYRIGHT & LICENSE | ||
| 61 | |||
| 62 | Copyright 2006 Robby Walker, all rights reserved. | ||
| 63 | |||
| 64 | This program is free software; you can redistribute it and/or modify it | ||
| 65 | under the same terms as Perl itself. | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | 1; |