summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/hilex/Makefile1
-rw-r--r--bin/hilex/ansi.c1
-rw-r--r--bin/hilex/hilex.120
-rw-r--r--bin/hilex/hilex.c1
-rw-r--r--bin/hilex/hilex.h4
-rw-r--r--bin/hilex/html.c1
-rw-r--r--bin/hilex/irc.c11
-rw-r--r--bin/hilex/make.l102
8 files changed, 130 insertions, 11 deletions
diff --git a/bin/hilex/Makefile b/bin/hilex/Makefile
index 5f6c1d80..c71738d6 100644
--- a/bin/hilex/Makefile
+++ b/bin/hilex/Makefile
@@ -5,6 +5,7 @@ OBJS += c.o
 OBJS += hilex.o
 OBJS += html.o
 OBJS += irc.o
+OBJS += make.o
 OBJS += mdoc.o
 OBJS += text.o
 
diff --git a/bin/hilex/ansi.c b/bin/hilex/ansi.c
index 0d337523..cdfcc845 100644
--- a/bin/hilex/ansi.c
+++ b/bin/hilex/ansi.c
@@ -27,6 +27,7 @@ static const char *SGR[ClassCap] = {
 	[Comment]       = "34",
 	[String]        = "36",
 	[StringFormat]  = "36;1;96",
+	[Interpolation] = "33",
 };
 
 static void ansiFormat(const char *opts[], enum Class class, const char *text) {
diff --git a/bin/hilex/hilex.1 b/bin/hilex/hilex.1
index eb429fb0..2b789f65 100644
--- a/bin/hilex/hilex.1
+++ b/bin/hilex/hilex.1
@@ -1,4 +1,4 @@
-.Dd December 28, 2020
+.Dd December 29, 2020
 .Dt HILEX 1
 .Os
 .
@@ -84,7 +84,8 @@ and one of the following:
 .Sy Comment ,
 .Sy String ,
 .Sy StringEscape ,
-.Sy StringFormat .
+.Sy StringFormat ,
+.Sy Interpolation .
 .
 .Pp
 The options are as follows:
@@ -151,21 +152,30 @@ with minimal support for
 .Xr lex 1 ,
 .Xr yacc 1
 and Objective-C input.
-Automatically inferred for
+Inferred for
 .Pa *.[chlmy]
 files.
 .
+.It Cm make
+The portable subset of
+.Xr make 1 .
+Inferred for
+.Pa *.mk
+and
+.Pa Makefile
+files.
+.
 .It Cm mdoc
 The
 .Xr mdoc 7
 language.
-Automatically inferred for
+Inferred for
 .Pa *.[1-9]
 files.
 .
 .It Cm text
 Plain text.
-Automatically inferred for
+Inferred for
 .Pa *.txt
 files.
 .El
diff --git a/bin/hilex/hilex.c b/bin/hilex/hilex.c
index b2bebd5f..1735b10a 100644
--- a/bin/hilex/hilex.c
+++ b/bin/hilex/hilex.c
@@ -32,6 +32,7 @@ static const struct {
 	const char *pattern;
 } Lexers[] = {
 	{ &LexC, "c", "[.][chlmy]$" },
+	{ &LexMake, "make", "[.]mk$|^Makefile$" },
 	{ &LexMdoc, "mdoc", "[.][1-9]$" },
 	{ &LexText, "text", "[.]txt$" },
 };
diff --git a/bin/hilex/hilex.h b/bin/hilex/hilex.h
index f9dcea24..fa16f1b6 100644
--- a/bin/hilex/hilex.h
+++ b/bin/hilex/hilex.h
@@ -30,7 +30,8 @@
 	X(Comment) \
 	X(String) \
 	X(StringEscape) \
-	X(StringFormat)
+	X(StringFormat) \
+	X(Interpolation)
 
 enum Class {
 #define X(class) class,
@@ -47,6 +48,7 @@ struct Lexer {
 };
 
 extern const struct Lexer LexC;
+extern const struct Lexer LexMake;
 extern const struct Lexer LexMdoc;
 extern const struct Lexer LexText;
 
diff --git a/bin/hilex/html.c b/bin/hilex/html.c
index c26d66ad..bec1d6a8 100644
--- a/bin/hilex/html.c
+++ b/bin/hilex/html.c
@@ -46,6 +46,7 @@ static const char *Style[ClassCap] = {
 	[Comment]       = "color: navy;",
 	[String]        = "color: teal;",
 	[StringFormat]  = "color: teal; font-weight: bold;",
+	[Interpolation] = "color: olive;",
 };
 
 static void styleTabSize(const char *tab) {
diff --git a/bin/hilex/irc.c b/bin/hilex/irc.c
index a83b55e6..deb35829 100644
--- a/bin/hilex/irc.c
+++ b/bin/hilex/irc.c
@@ -22,11 +22,12 @@
 #include "hilex.h"
 
 static const char *IRC[ClassCap] = {
-	[Keyword]      = "\00315",
-	[Macro]        = "\0033",
-	[Comment]      = "\0032",
-	[String]       = "\00310",
-	[StringFormat] = "\00311",
+	[Keyword]       = "\00315",
+	[Macro]         = "\0033",
+	[Comment]       = "\0032",
+	[String]        = "\00310",
+	[StringFormat]  = "\00311",
+	[Interpolation] = "\0037",
 };
 
 static void ircHeader(const char *opts[]) {
diff --git a/bin/hilex/make.l b/bin/hilex/make.l
new file mode 100644
index 00000000..00c1acca
--- /dev/null
+++ b/bin/hilex/make.l
@@ -0,0 +1,102 @@
+/* Copyright (C) 2020  June McEnroe <june@causal.agency>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+%option prefix="make"
+%option noyywrap
+
+%{
+#include "hilex.h"
+%}
+
+%s Assign
+%x Interp Shell
+
+ident [._[:alnum:]]+
+target [-/._[:alnum:]]+
+assign [!+:?]?=
+
+%%
+	static int pop = INITIAL;
+	static int depth = 0;
+
+^"\t" {
+	BEGIN(pop = Shell);
+	return Normal;
+}
+<Shell>{
+	"\n" {
+		BEGIN(pop = INITIAL);
+		return Normal;
+	}
+	[^\n$]+|. { return Normal; }
+}
+
+[[:blank:]] { return Normal; }
+
+"."(PHONY|PRECIOUS|SUFFIXES)/":"? {
+	return Keyword;
+}
+
+^{ident}/[[:blank:]]*{assign} {
+	return Identifier;
+}
+
+{assign} {
+	BEGIN(pop = Assign);
+	return Operator;
+}
+<Assign>{
+	"\n" {
+		BEGIN(pop = INITIAL);
+		return Normal;
+	}
+	[^$[:space:]]+ { return String; }
+}
+
+{target}([[:blank:]]+{target})*/":" {
+	return IdentifierTag;
+}
+
+^"-"?include { return Macro; }
+
+"#".* { return Comment; }
+
+<*>{
+	"$"("{"|"(") {
+		depth++;
+		BEGIN(Interp);
+		return Interpolation;
+	}
+	"$". { return Interpolation; }
+}
+<Interp>{
+	"}"|")" {
+		if (!--depth) BEGIN(pop);
+		return Interpolation;
+	}
+	[^${}()]+ { return Interpolation; }
+}
+
+.|\n { return Normal; }
+
+%{
+	(void)yyunput;
+	(void)input;
+%}
+
+%%
+
+const struct Lexer LexMake = { yylex, &yyin, &yytext };
mmit/tests/Makefile?id=2ef4edee19c3f935dfffc3e0f4a56f5e2f183fa4&follow=1'>tests: allow shell to be overriddenJohn Keeping On some systems (e.g. Solaris), /bin/sh is not a POSIX shell. Git already provides suitable overrides in its config.mak.uname file and we provide cgit.conf to allow the user to further change this. The code for this is taken from Git's t/Makefile, meaning that we now invoke the tests in the same way that Git does. Signed-off-by: John Keeping <john@keeping.me.uk> 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping This crept in while rebasing the previous commit onto an updated upstream. Signed-off-by: John Keeping <john@keeping.me.uk> 2015-08-12log: allow users to follow a fileJohn Keeping Teach the "log" UI to behave in the same way as "git log --follow", when given a suitable instruction by the user. The default behaviour remains to show the log without following renames, but the follow behaviour can be activated by following a link in the page header. Follow is not the default because outputting merges in follow mode is tricky ("git log --follow" will not show merges). We also disable the graph in follow mode because the commit graph is not simplified so we end up with frequent gaps in the graph and many lines that do not connect with any commits we're actually showing. We also teach the "diff" and "commit" UIs to respect the follow flag on URLs, causing the single-file version of these UIs to detect renames. This feature is needed only for commits that rename the path we're interested in. For commits before the file has been renamed (i.e. that appear later in the log list) we change the file path in the links from the log to point to the old name; this means that links to commits always limit by the path known to that commit. If we didn't do this we would need to walk down the log diff'ing every commit whenever we want to show a commit. The drawback is that the "Log" link in the top bar of such a page links to the log limited by the old name, so it will only show pre-rename commits. I consider this a reasonable trade-off since the "Back" button still works and the log matches the path displayed in the top bar. Since following renames requires running diff on every commit we consider, I've added a knob to the configuration file to globally enable/disable this feature. Note that we may consider a large number of commits the revision walking machinery no longer performs any path limitation so we have to examine every commit until we find a page full of commits that affect the target path or something related to it. Suggested-by: René Neumann <necoro@necoro.eu> Signed-off-by: John Keeping <john@keeping.me.uk> 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping This will allow us to use this nice wrapper function elsewhere, avoiding dealing with the diff queue when we only need to inspect a filepair. Signed-off-by: John Keeping <john@keeping.me.uk> 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld Otherwise we can't easily embed links to other /about/ pages. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2015-08-12filters: apply HTML escapingLazaros Koromilas http://www.w3.org/International/questions/qa-escapes#use 2015-08-12git: update to v2.5.0Christian Hesse Update to git version v2.5.0. * Upstream commit 5455ee0573a22bb793a7083d593ae1ace909cd4c (Merge branch 'bc/object-id') changed API: for_each_ref() callback functions were taught to name the objects not with "unsigned char sha1[20]" but with "struct object_id". * Upstream commit dcf692625ac569fefbe52269061230f4fde10e47 (path.c: make get_pathname() call sites return const char *) Signed-off-by: Christian Hesse <mail@eworm.de> 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt