From e23760fb259501bcd1f42cdb7088c5edbea84688 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 17 Oct 2000 23:45:00 +0000 Subject: [PATCH] Fixed to work with multiline syntaxes (by lite) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@766 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- findsyntax.pl | 14 ++++++++++++++ syntax.pl | 7 ++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 findsyntax.pl diff --git a/findsyntax.pl b/findsyntax.pl new file mode 100755 index 00000000..5389302c --- /dev/null +++ b/findsyntax.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w + +while(<>) { + if(m!/\*.SYNTAX\:! || $tt) { + s!^\s+! !; + if (m#\*/#) { + $tt=0; + } else { + $tt=1; + chomp; + } + print; + } +} diff --git a/syntax.pl b/syntax.pl index 5bcb8a3a..7760457b 100755 --- a/syntax.pl +++ b/syntax.pl @@ -10,8 +10,8 @@ # Remember to include the asterisk ('*'). $SRC_PATH='src'; -# This is quick and dirty, but works for sure :) -$FOO = `find src -name '*.c' -exec grep -e '/* SYNTAX:' \{\} \\; | sed 's/.*SYNTAX: //' > irssi_syntax`; +$FOO = `find src -name '*.c' -exec ./findsyntax.pl \{\} \\; | sed 's/.*SYNTAX: //' > irssi_syntax`; + while () { open (FILE, "$_"); @@ -21,7 +21,8 @@ while () { if ($DATARIVI =~ /\@SYNTAX\:(.+)\@/) { $etsittava = "\U$1 "; $SYNTAX = `grep \'^$etsittava\' irssi_syntax`; - $SYNTAX =~ s/\*\///g; $SYNTAX =~ s/ *$//; + $SYNTAX =~ s/\*\///g; + $SYNTAX =~ s/ *$//; $SYNTAX =~ s/ *\n/\n/g; $DATARIVI = $SYNTAX; } }