Skip to content

Commit

Permalink
tidy up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
billhails committed Nov 7, 2024
1 parent 7540e8a commit 1a0cbe5
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 444 deletions.
2 changes: 1 addition & 1 deletion fn/wonderful-life.fn
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ let
puts("}\n");
}
in
printTree(generateTree(0.64046))
printTree(generateTree(0.64316))
8 changes: 7 additions & 1 deletion src/pratt_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,15 +797,21 @@ static PrattParser *meldParsers(PrattParser *to, PrattParser *from) {
if (record->infixImpl) {
if (target->infixImpl) {
parserError(to, "import redefines infix operator %s", op->name);
} else if (target->postfixImpl) {
parserError(to, "import defines infix operator %s"
" over existing postfix operator", op->name);
} else {
target->infixImpl = record->infixImpl;
target->infixPrec = record->infixPrec;
target->infixOp = record->infixOp;
}
}
if (record->postfixImpl) {
if (target->infixImpl) {
if (target->postfixImpl) {
parserError(to, "import redefines postfix operator %s", op->name);
} else if (target->postfixImpl) {
parserError(to, "import defines postfix operator %s"
" over existing infix operator", op->name);
} else {
target->postfixImpl = record->postfixImpl;
target->postfixPrec = record->postfixPrec;
Expand Down
8 changes: 4 additions & 4 deletions src/pratt_scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
# include "debugging_off.h"
#endif

#define TOKFN(name, string) \
HashSymbol *TOK_ ## name(void) { \
static HashSymbol *s = NULL; \
#define TOKFN(name, string) \
HashSymbol *TOK_ ## name(void) { \
static HashSymbol *s = NULL; \
if (s == NULL) s = newSymbol(string); \
return s; \
return s; \
}

TOKFN(MACRO,"macro")
Expand Down
Loading

0 comments on commit 1a0cbe5

Please sign in to comment.