Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: parseLatex
Type: Package
Title: Parse 'LaTeX' Code
Version: 0.4.2
Version: 0.4.3
Authors@R: c(
person(
"Duncan", "Murdoch",
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# parseLatex 0.4.2
# parseLatex 0.4.3

* Improved support for syntax of `\let` and `\def`.
* Fixed error in C code as requested by CRAN.

# parseLatex 0.4.1

Expand Down
14 changes: 10 additions & 4 deletions src/gramLatex.tab.c
Original file line number Diff line number Diff line change
Expand Up @@ -3158,11 +3158,17 @@ static void yyerror(const char *s)

if (!strncmp(s, yyunexpected, sizeof yyunexpected -1)) {
int i, translated = FALSE;

/* Make local copy so we can modify it */
char s1[PARSE_ERROR_SIZE + 1];
strncpy(s1, s, PARSE_ERROR_SIZE);
s1[PARSE_ERROR_SIZE] = 0;

/* Edit the error message */
expecting = strstr(s + sizeof yyunexpected -1, yyexpecting);
expecting = strstr(s1 + sizeof yyunexpected -1, yyexpecting);
if (expecting) *expecting = '\0';
for (i = 0; yytname_translations[i]; i += 2) {
if (!strcmp(s + sizeof yyunexpected - 1, yytname_translations[i])) {
if (!strcmp(s1 + sizeof yyunexpected - 1, yytname_translations[i])) {
if (yychar < 256 || yychar == END_OF_INPUT)
snprintf(ParseErrorMsg, PARSE_ERROR_SIZE,
_(yyshortunexpected),
Expand All @@ -3182,11 +3188,11 @@ static void yyerror(const char *s)
if (yychar < 256 || yychar == END_OF_INPUT)
snprintf(ParseErrorMsg, PARSE_ERROR_SIZE,
_(yyshortunexpected),
s + sizeof yyunexpected - 1);
s1 + sizeof yyunexpected - 1);
else
snprintf(ParseErrorMsg, PARSE_ERROR_SIZE,
_(yylongunexpected),
s + sizeof yyunexpected - 1, CHAR(STRING_ELT(yylval, 0)));
s1 + sizeof yyunexpected - 1, CHAR(STRING_ELT(yylval, 0)));
}
if (expecting) {
translated = FALSE;
Expand Down
14 changes: 10 additions & 4 deletions src/parser/gramLatex.y
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,17 @@ static void yyerror(const char *s)

if (!strncmp(s, yyunexpected, sizeof yyunexpected -1)) {
int i, translated = FALSE;

/* Make local copy so we can modify it */
char s1[PARSE_ERROR_SIZE + 1];
strncpy(s1, s, PARSE_ERROR_SIZE);
s1[PARSE_ERROR_SIZE] = 0;

/* Edit the error message */
expecting = strstr(s + sizeof yyunexpected -1, yyexpecting);
expecting = strstr(s1 + sizeof yyunexpected -1, yyexpecting);
if (expecting) *expecting = '\0';
for (i = 0; yytname_translations[i]; i += 2) {
if (!strcmp(s + sizeof yyunexpected - 1, yytname_translations[i])) {
if (!strcmp(s1 + sizeof yyunexpected - 1, yytname_translations[i])) {
if (yychar < 256 || yychar == END_OF_INPUT)
snprintf(ParseErrorMsg, PARSE_ERROR_SIZE,
_(yyshortunexpected),
Expand All @@ -1093,11 +1099,11 @@ static void yyerror(const char *s)
if (yychar < 256 || yychar == END_OF_INPUT)
snprintf(ParseErrorMsg, PARSE_ERROR_SIZE,
_(yyshortunexpected),
s + sizeof yyunexpected - 1);
s1 + sizeof yyunexpected - 1);
else
snprintf(ParseErrorMsg, PARSE_ERROR_SIZE,
_(yylongunexpected),
s + sizeof yyunexpected - 1, CHAR(STRING_ELT(yylval, 0)));
s1 + sizeof yyunexpected - 1, CHAR(STRING_ELT(yylval, 0)));
}
if (expecting) {
translated = FALSE;
Expand Down
Loading