summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-07-13 21:40:12 +0000
committerKarl Berry <karl@freefriends.org>2019-07-13 21:40:12 +0000
commit757d85974d6b7911f766ae371404144ec3bdce34 (patch)
tree795c61e735cf8826289bb477020f3e50ec5aa914 /Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
parent8e8c05aa6d6db2c28633a8924de4a0b941b52030 (diff)
latexindent (13jul19)
git-svn-id: svn://tug.org/texlive/trunk@51635 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm42
1 files changed, 25 insertions, 17 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
index 7c84a0e65f3..96450fdaaf2 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm
@@ -24,7 +24,7 @@ use LatexIndent::LogFile qw/$logger/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
-our @EXPORT_OK = qw/get_arguments_regexp find_opt_mand_arguments get_numbered_arg_regexp construct_arguments_regexp $optAndMandRegExp/;
+our @EXPORT_OK = qw/get_arguments_regexp find_opt_mand_arguments construct_arguments_regexp $optAndMandRegExp comma_else/;
our $ArgumentCounter;
our $optAndMandRegExp;
our $optAndMandRegExpWithLineBreaks;
@@ -222,13 +222,6 @@ sub create_unique_id{
return;
}
-sub get_numbered_arg_regexp{
-
- # for example #1 #2, etc
- my $numberedArgRegExp = qr/(?:#\d\h*;?,?\/?)+/;
- return $numberedArgRegExp;
-}
-
sub get_arguments_regexp{
my $self = shift;
@@ -240,11 +233,9 @@ sub get_arguments_regexp{
# some calls to this routine need to account for the linebreaks at the end, some do not
my $lineBreaksAtEnd = (defined ${input}{mode} and ${input}{mode} eq 'lineBreaksAtEnd')?'\R*':q();
- # for example #1 #2, etc
- my $numberedArgRegExp = $self->get_numbered_arg_regexp;
-
- # beamer special
- my $beamerRegExp = qr/\<.*?\>/;
+ # arguments Before, by default, includes beamer special and numbered arguments, for example #1 #2, etc
+ my $argumentsBefore = qr/${${$masterSettings{fineTuning}}{arguments}}{before}/;
+ my $argumentsBetween = qr/${${$masterSettings{fineTuning}}{arguments}}{between}/;
# commands are allowed strings between arguments, e.g node, decoration, etc, specified in stringsAllowedBetweenArguments
my $stringsBetweenArguments = q();
@@ -272,7 +263,7 @@ sub get_arguments_regexp{
return qr/
( # capture into $1
(?:
- (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$numberedArgRegExp|$beamerRegExp|_|\^|$stringsBetweenArguments)*
+ (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$argumentsBefore|$argumentsBetween|$stringsBetweenArguments)*
(?:
(?:
\h* # 0 or more spaces
@@ -332,7 +323,7 @@ sub get_arguments_regexp{
# NOT followed by
(?!
(?:
- (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$numberedArgRegExp|$beamerRegExp|$stringsBetweenArguments)* # 0 or more h-space, blanklines, trailing comments
+ (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$argumentsBefore|$stringsBetweenArguments)* # 0 or more h-space, blanklines, trailing comments
(?:
(?:(?<!\\)\[)
|
@@ -350,7 +341,7 @@ sub get_arguments_regexp{
return qr/
( # capture into $1
(?:
- (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$numberedArgRegExp|$beamerRegExp|_|\^|$stringsBetweenArguments)*
+ (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$argumentsBefore|$argumentsBetween|$stringsBetweenArguments)*
(?:
(?:
\h* # 0 or more spaces
@@ -383,7 +374,7 @@ sub get_arguments_regexp{
# NOT followed by
(?!
(?:
- (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$numberedArgRegExp|$beamerRegExp)* # 0 or more h-space, blanklines, trailing comments
+ (?:\h|\R|$blankLineToken|$trailingCommentRegExp|$argumentsBefore)* # 0 or more h-space, blanklines, trailing comments
(?:
(?:(?<!\\)\[)
|
@@ -398,4 +389,21 @@ sub get_arguments_regexp{
}
}
+sub comma_else{
+ my $self = shift;
+
+ # check for existence of \\ statement, and associated line break information
+ $self->check_for_else_statement(
+ # else name regexp
+ elseNameRegExp=>qr/${${$masterSettings{fineTuning}}{modifyLineBreaks}}{comma}/,
+ # else statements name
+ ElseStartsOnOwnLine=>"CommaStartsOnOwnLine",
+ # end statements
+ ElseFinishesWithLineBreak=>"CommaFinishesWithLineBreak",
+ # for the YAML settings storage
+ storageNameAppend=>"comma",
+ # logfile information
+ logName=>"comma block, see CommaStartsOnOwnLine and CommaFinishesWithLineBreak",
+ );
+}
1;