Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moose subparser based on perl parser #2070

Merged
merged 4 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tmain/list-fields-with-prefix.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ x UCTAGSxpath no NONE s-- no xpath for the
- UCTAGSpackageName yes Go s-- no the name for referring the package
- UCTAGSassignment yes LdScript s-- no how a value is assigned to the symbol
- UCTAGSsectionMarker no Markdown s-- no character used for declaring section(#, ##, =, or -)
- UCTAGSwrapping yes Moose s-- no how a wrapper wrapping the method (around, after, or before)
- UCTAGScategory yes ObjectiveC s-- no category attached to the class
- UCTAGSprotocols yes ObjectiveC s-- no protocols that the class (or category) confirms to
- UCTAGShome yes Passwd s-- no home directory
Expand Down
1 change: 1 addition & 0 deletions Tmain/list-fields.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ z kind no NONE s-- no Include the "kind:" key in kind field (use k or K) in tags
- packageName yes Go s-- no the name for referring the package
- assignment yes LdScript s-- no how a value is assigned to the symbol
- sectionMarker no Markdown s-- no character used for declaring section(#, ##, =, or -)
- wrapping yes Moose s-- no how a wrapper wrapping the method (around, after, or before)
- category yes ObjectiveC s-- no category attached to the class
- protocols yes ObjectiveC s-- no protocols that the class (or category) confirms to
- home yes Passwd s-- no home directory
Expand Down
1 change: 1 addition & 0 deletions Tmain/list-subparsers-all.d/stdout-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Autoconf M4 base <> sub {bidirectional}
Automake Make base <= sub {dedicated}
ITcl Tcl base <> sub {bidirectional}
Moose Perl base <> sub {bidirectional}
PythonLoggingConfig Iniconf base <> sub {bidirectional}
QtMoc C++ base <> sub {bidirectional}
RSpec Ruby base => sub {shared}
Expand Down
3 changes: 3 additions & 0 deletions Units/simple-moose.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--sort=no
--fields=+lineK
--extras=+s
32 changes: 32 additions & 0 deletions Units/simple-moose.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Point input.pl /^package Point;$/;" package line:2 language:Perl
Point input.pl /^package Point;$/;" class line:2 language:Moose
x input.pl /^has 'x' => (is => 'rw', isa => 'Int');$/;" attribute line:5 language:Moose class:Point
y input.pl /^has 'y' => (is => 'rw', isa => 'Int');$/;" attribute line:6 language:Moose class:Point
z0 input.pl /^has z0 => (is => 'rw');$/;" attribute line:8 language:Moose class:Point
z1 input.pl /^has 'z1' => (is => 'rw');$/;" attribute line:9 language:Moose class:Point
z2 input.pl /^has "z2" => (is => 'rw');$/;" attribute line:10 language:Moose class:Point
z0p input.pl /^has (z0p => (is => 'rw'));$/;" attribute line:12 language:Moose class:Point
z1p input.pl /^has ('z1p' => (is => 'rw'));$/;" attribute line:13 language:Moose class:Point
z2p input.pl /^has ("z2p" => (is => 'rw'));$/;" attribute line:14 language:Moose class:Point
z0ps input.pl /^has ( z0ps => (is => 'rw'));$/;" attribute line:16 language:Moose class:Point
z1ps input.pl /^has ( 'z1ps' => (is => 'rw'));$/;" attribute line:17 language:Moose class:Point
z2ps input.pl /^has ( "z2ps" => (is => 'rw'));$/;" attribute line:18 language:Moose class:Point
z3 input.pl /^has [qw#z3 z4 z5#] => ((is => 'rw'),(is => 'rw'),(is => 'rw'));$/;" attribute line:20 language:Moose class:Point
z4 input.pl /^has [qw#z3 z4 z5#] => ((is => 'rw'),(is => 'rw'),(is => 'rw'));$/;" attribute line:20 language:Moose class:Point
z5 input.pl /^has [qw#z3 z4 z5#] => ((is => 'rw'),(is => 'rw'),(is => 'rw'));$/;" attribute line:20 language:Moose class:Point
z6 input.pl /^has ([qw|z6 z7|] => (is => 'rw'), (is => 'rw'));$/;" attribute line:21 language:Moose class:Point
z7 input.pl /^has ([qw|z6 z7|] => (is => 'rw'), (is => 'rw'));$/;" attribute line:21 language:Moose class:Point
clear input.pl /^sub clear {$/;" subroutine line:23 language:Perl
clear input.pl /^sub clear {$/;" method line:23 language:Moose class:Point
Point3D input.pl /^package Point3D;$/;" package line:29 language:Perl
Point3D input.pl /^package Point3D;$/;" class line:29 language:Moose inherits:Point
z input.pl /^has 'z' => (is => 'rw', isa => 'Int');$/;" attribute line:34 language:Moose class:Point3D
clear input.pl /^before 'clear' => sub {$/;" wrapper line:36 language:Moose class:Point3D wrapping:before
clear input.pl /^after 'clear' => sub {$/;" wrapper line:39 language:Moose class:Point3D wrapping:after
clear input.pl /^around 'clear' => sub {$/;" wrapper line:42 language:Moose class:Point3D wrapping:around
TimeAxis input.pl /^package TimeAxis;$/;" package line:45 language:Perl
TimeAxis input.pl /^package TimeAxis;$/;" class line:45 language:Moose
Point4D input.pl /^package Point4D;$/;" package line:48 language:Perl
Point4D input.pl /^package Point4D;$/;" class line:48 language:Moose inherits:Point3D,TimeAxis end:57
clear input.pl /^override "clear" => sub {$/;" method line:54 language:Moose class:Point4D
Line input.pl /^package Line;$/;" package line:58 language:Perl
58 changes: 58 additions & 0 deletions Units/simple-moose.d/input.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Taken from https://metacpan.org/pod/Moose
package Point;
use Moose; # automatically turns on strict and warnings

has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');

has z0 => (is => 'rw');
has 'z1' => (is => 'rw');
has "z2" => (is => 'rw');

has (z0p => (is => 'rw'));
has ('z1p' => (is => 'rw'));
has ("z2p" => (is => 'rw'));

has ( z0ps => (is => 'rw'));
has ( 'z1ps' => (is => 'rw'));
has ( "z2ps" => (is => 'rw'));

has [qw#z3 z4 z5#] => ((is => 'rw'),(is => 'rw'),(is => 'rw'));
has ([qw|z6 z7|] => (is => 'rw'), (is => 'rw'));

sub clear {
my $self = shift;
$self->x(0);
$self->y(0);
}

package Point3D;
use Moose;

extends 'Point';

has 'z' => (is => 'rw', isa => 'Int');

before 'clear' => sub {
};

after 'clear' => sub {
};

around 'clear' => sub {
};

package TimeAxis;
use Moose;

package Point4D;
use Moose;

extends 'Point3D',
'TimeAxis' ;

override "clear" => sub {
};

no Moose;
package Line;
1 change: 1 addition & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The following parsers have been added:
* Man page *optlib*
* Markdown *optlib*
* Maven2 *libxml*
* Moose *perl basesd subperser*
* M4
* ObjectiveC
* Passwd *optlib*
Expand Down
2 changes: 1 addition & 1 deletion main/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4146,7 +4146,7 @@ extern subparser *getNextSubparser(subparser *last,
t = getSubparserLanguage(r);
if (isLanguageEnabled (t) &&
(includingNoneCraftedParser
|| ((((LanguageTable + t)->def->method) && METHOD_NOT_CRAFTED) == 0)))
|| ((((LanguageTable + t)->def->method) & METHOD_NOT_CRAFTED) == 0)))
return r;
else
return getNextSubparser (r, includingNoneCraftedParser);
Expand Down
1 change: 1 addition & 0 deletions main/parsers_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
MakefileParser, \
MarkdownParser, \
MatLabParser, \
MooseParser, \
MyrddinParser, \
ObjcParser, \
OldCppParser, \
Expand Down
Loading