[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs extra-modes.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs extra-modes.c |
Date: |
Tue, 12 Jul 2016 07:50:19 +0000 (UTC) |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 16/07/12 07:50:19
Modified files:
. : extra-modes.c
Log message:
use new style parser for pascal colorizer
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/extra-modes.c?cvsroot=qemacs&r1=1.52&r2=1.53
Patches:
Index: extra-modes.c
===================================================================
RCS file: /sources/qemacs/qemacs/extra-modes.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- extra-modes.c 8 Jun 2016 00:35:04 -0000 1.52
+++ extra-modes.c 12 Jul 2016 07:50:19 -0000 1.53
@@ -576,7 +576,7 @@
unsigned int *str, int n, ModeDef *syn)
{
char keyword[MAX_KEYWORD_SIZE];
- int i = 0, start = i, c, k, style, len;
+ int i = 0, start = i, c, k, style = 0, len;
int colstate = cp->colorize_state;
if (colstate & IN_PASCAL_COMMENT)
@@ -595,53 +595,47 @@
case '/':
if (str[i] == '/') { /* C++ comments, recent extension */
i = n;
- SET_COLOR(str, start, i, PASCAL_STYLE_COMMENT);
- continue;
- }
+ style = PASCAL_STYLE_COMMENT;
break;
+ }
+ continue;
case '{':
/* check for preprocessor */
if (str[i] == '$') {
colstate = IN_PASCAL_COMMENT1;
i++;
in_comment1:
- while (i < n) {
- if (str[i++] == '}') {
- colstate = 0;
- break;
- }
- }
- SET_COLOR(str, start, i, PASCAL_STYLE_PREPROCESS);
+ style = PASCAL_STYLE_PREPROCESS;
} else {
/* regular comment (recursive?) */
colstate = IN_PASCAL_COMMENT;
in_comment:
+ style = PASCAL_STYLE_COMMENT;
+ }
while (i < n) {
if (str[i++] == '}') {
colstate = 0;
break;
}
}
- SET_COLOR(str, start, i, PASCAL_STYLE_COMMENT);
- }
- continue;
+ break;
case '(':
/* check for preprocessor */
- if (str[i] != '*')
- break;
-
+ if (str[i] == '*') {
/* regular comment (recursive?) */
colstate = IN_PASCAL_COMMENT2;
i++;
in_comment2:
- for (; i < n; i++) {
- if (str[i] == '*' && str[i + 1] == ')') {
- i += 2;
+ while (i < n) {
+ if (str[i++] == '*' && str[i] == ')') {
+ i++;
colstate = 0;
break;
}
}
- SET_COLOR(str, start, i, PASCAL_STYLE_COMMENT);
+ style = PASCAL_STYLE_COMMENT;
+ break;
+ }
continue;
case '\'':
/* parse string or char const */
@@ -650,27 +644,25 @@
if (str[i++] == (unsigned int)c)
break;
}
- SET_COLOR(str, start, i, PASCAL_STYLE_STRING);
- continue;
+ style = PASCAL_STYLE_STRING;
+ break;
case '#':
/* parse hex char const */
for (; i < n; i++) {
if (!qe_isxdigit(str[i]))
break;
}
- SET_COLOR(str, start, i, PASCAL_STYLE_STRING);
- continue;
- default:
+ style = PASCAL_STYLE_STRING;
break;
- }
+ default:
/* parse numbers */
if (qe_isdigit(c) || c == '$') {
for (; i < n; i++) {
if (!qe_isalnum(str[i]) && str[i] != '.')
break;
}
- SET_COLOR(str, start, i, PASCAL_STYLE_NUMBER);
- continue;
+ style = PASCAL_STYLE_NUMBER;
+ break;
}
/* parse identifiers and keywords */
if (qe_isalpha_(c)) {
@@ -695,9 +687,14 @@
else
style = PASCAL_STYLE_IDENTIFIER;
}
- SET_COLOR(str, start, i, style);
+ break;
+ }
continue;
}
+ if (style) {
+ SET_COLOR(str, start, i, style);
+ style = 0;
+ }
}
cp->colorize_state = colstate;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs extra-modes.c,
Charlie Gordon <=