From 910e9267aef4961a5c61bdbd548a4d7e199c5318 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Thu, 21 Dec 2006 01:20:36 -0600 Subject: [PATCH] Better m4.lang and sh.lang --- .hgignore | 1 + moo/mooedit/language-specs/Makefile.am | 52 +-- moo/mooedit/language-specs/kate.styles | 2 + moo/mooedit/language-specs/m4.lang | 518 +++++++++++++++++++++++- moo/mooedit/language-specs/sh.lang | 33 +- moo/mooedit/language-specs/testfiles.sh | 463 +++++++++++++++++++++ 6 files changed, 1027 insertions(+), 42 deletions(-) create mode 100755 moo/mooedit/language-specs/testfiles.sh diff --git a/.hgignore b/.hgignore index 2b8fcf07..cfc8b65a 100644 --- a/.hgignore +++ b/.hgignore @@ -57,3 +57,4 @@ moo/mooterm/termhelper_res\.rc$ .*\.(new|old).* gmon\.out py-compile +^moo/mooedit/language-specs/testfiles/.*$ diff --git a/moo/mooedit/language-specs/Makefile.am b/moo/mooedit/language-specs/Makefile.am index 8bbc116e..67c44052 100644 --- a/moo/mooedit/language-specs/Makefile.am +++ b/moo/mooedit/language-specs/Makefile.am @@ -1,53 +1,53 @@ languagespecsdir = ${MOO_TEXT_LANG_FILES_DIR} langs2 = \ - c.lang \ + ada.lang \ changelog.lang \ + c.lang \ cpp.lang \ + csharp.lang \ + css.lang \ def.lang \ + desktop.lang \ + diff.lang \ + fortran.lang \ gap.lang \ + gtkrc.lang \ + haskell.lang \ html.lang \ + idl.lang \ + ini.lang \ + java.lang \ javascript.lang \ latex.lang \ m4.lang \ makefile.lang \ ms.lang \ - python.lang \ - python-console.lang \ - sh.lang \ - xml.lang \ - yacc.lang - -langs1 = \ - ada.lang \ - boo.lang \ - check.sh \ - csharp.lang \ - css.lang \ - d.lang \ - desktop.lang \ - diff.lang \ - fortran.lang \ - gtkrc.lang \ - haskell.lang \ - idl.lang \ - ini.lang \ - java.lang \ - lua.lang \ - msil.lang \ - nemerle.lang \ octave.lang \ pascal.lang \ perl.lang \ php.lang \ po.lang \ - R.lang \ + python-console.lang \ + python.lang \ ruby.lang \ scheme.lang \ sh.lang \ + sh.lang \ sql.lang \ tcl.lang \ texinfo.lang \ + xml.lang \ + yacc.lang + +langs1 = \ + boo.lang \ + check.sh \ + d.lang \ + lua.lang \ + msil.lang \ + nemerle.lang \ + R.lang \ vbnet.lang \ verilog.lang \ vhdl.lang diff --git a/moo/mooedit/language-specs/kate.styles b/moo/mooedit/language-specs/kate.styles index 223aaa17..f33b2aeb 100644 --- a/moo/mooedit/language-specs/kate.styles +++ b/moo/mooedit/language-specs/kate.styles @@ -58,6 +58,8 @@ + + + Hi there! + + +EOFEOF + +cat > $dir/file.tex < $dir/file.m4 < $dir/file.sh < $dir/Makefile < $dir/file.ms < $dir/file.py <> sys.stderr, "Hi there!" +Hello().hello() +EOFEOF + +cat > $dir/file.xml < + + momomomo + +EOFEOF + +cat > $dir/file.y < +#define FOO_BAR(x,y) printf ("x, y") +%} + +%name-prefix="foolala" +%error-verbose +%lex-param {FooLaLa *lala} +%parse-param {FooLaLa *lala} +/* %expect 1 */ + +%union { + int ival; + const char *str; +} + +%token ATOKEN +%token ATOKEN2 + +%type program stmt +%type if_stmt + +%token IF THEN ELSE ELIF FI +%token WHILE DO OD FOR IN +%token CONTINUE BREAK RETURN +%token EQ NEQ LE GE +%token AND OR NOT +%token UMINUS +%token TWODOTS + +%left '-' '+' +%left '*' '/' +%left '%' +%left EQ NEQ '<' '>' GE LE +%left OR +%left AND +%left NOT +%left '#' +%left UMINUS + +%% + +script: program { _ms_parser_set_top_node (parser, $1); } +; + +program: stmt_or_error { $$ = node_list_add (parser, NULL, $1); } + | program stmt_or_error { $$ = node_list_add (parser, MS_NODE_LIST ($1), $2); } +; + +stmt_or_error: + error ';' { $$ = NULL; } + | stmt ';' { $$ = $1; } +; + +variable: IDENTIFIER { $$ = node_var (parser, $1); } +; + +%% +EOFEOF + + +cat > $dir/file.cs < $dir/file.css < $dir/file.desktop < $dir/file.diff < $dir/file.f < $dir/gtkrc < $dir/file.ini < $dir/file.java < $dir/file.m < $dir/file.pas < $dir/file.pl <$title\n\n" if $title; + +$last = {}; # the last indexterm we processed +$first = 1; # this is the first one +$group = ""; # we're not in a group yet +$lastout = ""; # we've not put anything out yet +@seealsos = (); # See also stack. + +# Termcount is > 0 iff some entries were skipped. +$quiet || print STDERR "$termcount entries ignored...\n"; + +&end_entry(); + +print OUT "\n" if $lettergroups; +print OUT "\n"; + +close (OUT); + +$quiet || print STDERR "Done.\n"; + +sub same { + my($a) = shift; + my($b) = shift; + + my($aP) = $a->{'psortas'} || $a->{'primary'}; + my($aS) = $a->{'ssortas'} || $a->{'secondary'}; + my($aT) = $a->{'tsortas'} || $a->{'tertiary'}; + + my($bP) = $b->{'psortas'} || $b->{'primary'}; + my($bS) = $b->{'ssortas'} || $b->{'secondary'}; + my($bT) = $b->{'tsortas'} || $b->{'tertiary'}; + + my($same); + + $aP =~ s/^\s*//; $aP =~ s/\s*$//; $aP = uc($aP); + $aS =~ s/^\s*//; $aS =~ s/\s*$//; $aS = uc($aS); + $aT =~ s/^\s*//; $aT =~ s/\s*$//; $aT = uc($aT); + $bP =~ s/^\s*//; $bP =~ s/\s*$//; $bP = uc($bP); + $bS =~ s/^\s*//; $bS =~ s/\s*$//; $bS = uc($bS); + $bT =~ s/^\s*//; $bT =~ s/\s*$//; $bT = uc($bT); + +# print "[$aP]=[$bP]\n"; +# print "[$aS]=[$bS]\n"; +# print "[$aT]=[$bT]\n"; + + # Two index terms are the same if: + # 1. the primary, secondary, and tertiary entries are the same + # (or have the same SORTAS) + # AND + # 2. They occur in the same titled section + # AND + # 3. They point to the same place + # + # Notes: Scope is used to suppress some entries, but can't be used + # for comparing duplicates. + # Interpretation of "the same place" depends on whether or + # not $linkpoints is true. + + $same = (($aP eq $bP) + && ($aS eq $bS) + && ($aT eq $bT) + && ($a->{'title'} eq $b->{'title'}) + && ($a->{'href'} eq $b->{'href'})); + + # If we're linking to points, they're only the same if they link + # to exactly the same spot. + $same = $same && ($a->{'hrefpoint'} eq $b->{'hrefpoint'}) + if $linkpoints; + + if ($same) { + warn "$me: duplicated index entry found: $aP $aS $aT\n"; + } + + $same; +} + +sub tsame { + # Unlike same(), tsame only compares a single term + my($a) = shift; + my($b) = shift; + my($term) = shift; + my($sterm) = substr($term, 0, 1) . "sortas"; + my($A, $B); + + $A = $a->{$sterm} || $a->{$term}; + $B = $b->{$sterm} || $b->{$term}; + + $A =~ s/^\s*//; $A =~ s/\s*$//; $A = uc($A); + $B =~ s/^\s*//; $B =~ s/\s*$//; $B = uc($B); + + return $A eq $B; +} + +=head1 EXAMPLE +B B<-o> F F +=head1 EXIT STATUS +=over 5 +=item B<0> +Success +=item B<1> +Failure +=back +=head1 AUTHOR +Norm Walsh Endw@nwalsh.comE +Minor updates by Adam Di Carlo Eadam@onshore.comE and Peter Eisentraut Epeter_e@gmx.netE +=cut +EOFEOF + +cat > $dir/file.php < $dir/file.po <, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2006-12-17 09:49-0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../medit/medit.desktop.in.h:1 +msgid "Text editor" +msgstr "" + +#: ../medit/medit.desktop.in.h:2 +msgid "medit" +msgstr "" +EOFEOF + +cat > $dir/file.rb < $dir/file.scm < $dir/file.sql < $dir/file.texi <