Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wrapl/minilang
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 593f2815fe3ad31b00594b088921c02500a66dce
Choose a base ref
...
head repository: wrapl/minilang
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0f6954483e1122d131327585da32ca8cb9b4d7f6
Choose a head ref

Commits on Oct 21, 2021

  1. Merge pull request #95 from wrapl/dev

    Dev
    rajamukherji authored Oct 21, 2021
    Copy the full SHA
    cd83850 View commit details

Commits on Nov 6, 2021

  1. Merge pull request #96 from wrapl/dev

    Dev
    rajamukherji authored Nov 6, 2021
    Copy the full SHA
    ace7239 View commit details

Commits on Nov 8, 2021

  1. Merge pull request #97 from wrapl/dev

    Dev
    rajamukherji authored Nov 8, 2021
    Copy the full SHA
    ddef298 View commit details

Commits on Dec 12, 2021

  1. Merge pull request #99 from wrapl/dev

    Dev
    rajamukherji authored Dec 12, 2021
    Copy the full SHA
    05fd3b0 View commit details

Commits on Jan 18, 2022

  1. Merge pull request #100 from wrapl/dev

    Dev
    rajamukherji authored Jan 18, 2022
    Copy the full SHA
    23d7426 View commit details
  2. Merge pull request #101 from wrapl/dev

    Updates.
    rajamukherji authored Jan 18, 2022
    Copy the full SHA
    5da1050 View commit details

Commits on Jan 23, 2022

  1. Merge pull request #102 from wrapl/dev

    Dev
    rajamukherji authored Jan 23, 2022
    Copy the full SHA
    440e528 View commit details

Commits on Jan 31, 2022

  1. Merge pull request #103 from wrapl/dev

    Dev
    rajamukherji authored Jan 31, 2022
    Copy the full SHA
    43f38e9 View commit details

Commits on Feb 14, 2022

  1. Merge pull request #104 from wrapl/dev

    Dev
    rajamukherji authored Feb 14, 2022
    Copy the full SHA
    4682a59 View commit details

Commits on Feb 25, 2022

  1. Merge pull request #105 from wrapl/dev

    Dev
    rajamukherji authored Feb 25, 2022
    Copy the full SHA
    6dc2c5f View commit details

Commits on Mar 3, 2022

  1. Merge pull request #106 from wrapl/dev

    Dev
    rajamukherji authored Mar 3, 2022
    Copy the full SHA
    e6722bd View commit details

Commits on Mar 7, 2022

  1. Merge pull request #107 from wrapl/dev

    Dev
    rajamukherji authored Mar 7, 2022
    Copy the full SHA
    230a481 View commit details
  2. Merge pull request #108 from wrapl/dev

    Updates.
    rajamukherji authored Mar 7, 2022
    Copy the full SHA
    4f53a41 View commit details
  3. Merge pull request #109 from wrapl/dev

    Updates.
    rajamukherji authored Mar 7, 2022
    Copy the full SHA
    276d884 View commit details

Commits on Mar 8, 2022

  1. Merge pull request #110 from wrapl/dev

    Dev
    rajamukherji authored Mar 8, 2022
    Copy the full SHA
    896adfc View commit details

Commits on Mar 10, 2022

  1. Merge pull request #111 from wrapl/dev

    Dev
    rajamukherji authored Mar 10, 2022
    Copy the full SHA
    6b0a555 View commit details
  2. Merge pull request #112 from wrapl/dev

    Dev
    rajamukherji authored Mar 10, 2022
    Copy the full SHA
    41ca054 View commit details

Commits on Mar 15, 2022

  1. Merge pull request #113 from wrapl/dev

    Dev
    rajamukherji authored Mar 15, 2022
    Copy the full SHA
    69ef5c1 View commit details

Commits on Mar 16, 2022

  1. Merge pull request #114 from wrapl/dev

    Dev
    rajamukherji authored Mar 16, 2022
    Copy the full SHA
    4f19260 View commit details
  2. Merge pull request #115 from wrapl/dev

    Updates.
    rajamukherji authored Mar 16, 2022
    Copy the full SHA
    1855882 View commit details

Commits on Mar 21, 2022

  1. Merge pull request #116 from wrapl/dev

    Dev
    rajamukherji authored Mar 21, 2022
    Copy the full SHA
    f365784 View commit details

Commits on Mar 23, 2022

  1. Merge pull request #117 from wrapl/dev

    Dev
    rajamukherji authored Mar 23, 2022
    Copy the full SHA
    46c141d View commit details

Commits on Mar 28, 2022

  1. Merge pull request #118 from wrapl/dev

    Dev
    rajamukherji authored Mar 28, 2022
    Copy the full SHA
    c09bd40 View commit details

Commits on Apr 1, 2022

  1. Merge pull request #119 from wrapl/dev

    Dev
    rajamukherji authored Apr 1, 2022
    Copy the full SHA
    1f6d287 View commit details

Commits on Apr 5, 2022

  1. Merge pull request #120 from wrapl/dev

    Dev
    rajamukherji authored Apr 5, 2022
    Copy the full SHA
    fbffa84 View commit details

Commits on Apr 15, 2022

  1. Merge pull request #121 from wrapl/dev

    Dev
    rajamukherji authored Apr 15, 2022
    Copy the full SHA
    7b3dc8e View commit details

Commits on Apr 19, 2022

  1. Merge pull request #122 from wrapl/dev

    Updates.
    rajamukherji authored Apr 19, 2022
    Copy the full SHA
    424d282 View commit details

Commits on Apr 21, 2022

  1. Merge pull request #123 from wrapl/dev

    Dev
    rajamukherji authored Apr 21, 2022
    Copy the full SHA
    a3e48b9 View commit details

Commits on May 10, 2022

  1. Merge pull request #124 from wrapl/dev

    Dev
    rajamukherji authored May 10, 2022
    Copy the full SHA
    f2cf8be View commit details

Commits on May 26, 2022

  1. Merge pull request #125 from wrapl/dev

    Dev
    rajamukherji authored May 26, 2022
    Copy the full SHA
    c747dc5 View commit details

Commits on Jun 21, 2022

  1. Merge pull request #126 from wrapl/dev

    Dev
    rajamukherji authored Jun 21, 2022
    Copy the full SHA
    a317b38 View commit details

Commits on Jun 23, 2022

  1. Merge pull request #127 from wrapl/dev

    Dev
    rajamukherji authored Jun 23, 2022
    Copy the full SHA
    20ebe9d View commit details

Commits on Jul 4, 2022

  1. Merge pull request #128 from wrapl/dev

    Dev
    rajamukherji authored Jul 4, 2022
    Copy the full SHA
    3cbc9b3 View commit details
  2. Merge pull request #129 from wrapl/dev

    Updates.
    rajamukherji authored Jul 4, 2022
    Copy the full SHA
    a0d9970 View commit details

Commits on Aug 22, 2022

  1. Merge pull request #131 from wrapl/dev

    Dev
    rajamukherji authored Aug 22, 2022
    Copy the full SHA
    e2f5d50 View commit details
  2. Merge pull request #132 from wrapl/dev

    Updates.
    rajamukherji authored Aug 22, 2022
    Copy the full SHA
    676637d View commit details

Commits on Sep 2, 2022

  1. Merge pull request #133 from wrapl/dev

    Dev
    rajamukherji authored Sep 2, 2022
    Copy the full SHA
    a3b41cc View commit details

Commits on Oct 5, 2022

  1. Merge pull request #134 from wrapl/dev

    Dev
    rajamukherji authored Oct 5, 2022
    Copy the full SHA
    43642a1 View commit details

Commits on Jan 5, 2023

  1. Merge pull request #135 from wrapl/dev

    Dev
    rajamukherji authored Jan 5, 2023
    Copy the full SHA
    ca95436 View commit details
  2. Merge pull request #136 from wrapl/dev

    Dev
    rajamukherji authored Jan 5, 2023
    Copy the full SHA
    9f4499f View commit details

Commits on Jan 14, 2023

  1. Merge pull request #137 from wrapl/dev

    Dev
    rajamukherji authored Jan 14, 2023
    Copy the full SHA
    9955bd6 View commit details

Commits on Feb 9, 2023

  1. Merge pull request #138 from wrapl/dev

    Dev
    rajamukherji authored Feb 9, 2023
    Copy the full SHA
    f57c13c View commit details

Commits on Mar 29, 2023

  1. Merge pull request #140 from wrapl/dev

    Dev
    rajamukherji authored Mar 29, 2023
    Copy the full SHA
    0765888 View commit details

Commits on May 8, 2023

  1. Merge pull request #141 from wrapl/dev

    Dev
    rajamukherji authored May 8, 2023
    Copy the full SHA
    4c770bc View commit details

Commits on May 11, 2023

  1. Merge pull request #142 from wrapl/dev

    Dev
    rajamukherji authored May 11, 2023
    Copy the full SHA
    2bd352e View commit details

Commits on May 18, 2023

  1. Merge pull request #143 from wrapl/dev

    Dev
    rajamukherji authored May 18, 2023
    Copy the full SHA
    bde555d View commit details

Commits on Jun 22, 2023

  1. Merge pull request #144 from wrapl/dev

    Dev
    rajamukherji authored Jun 22, 2023
    Copy the full SHA
    25bdbe3 View commit details

Commits on Jul 23, 2023

  1. Merge pull request #145 from wrapl/dev

    Dev
    rajamukherji authored Jul 23, 2023
    Copy the full SHA
    44627b7 View commit details

Commits on Jul 24, 2023

  1. Merge pull request #146 from wrapl/dev

    Dev
    rajamukherji authored Jul 24, 2023
    Copy the full SHA
    55583d0 View commit details
  2. Merge pull request #147 from wrapl/dev

    Updates.
    rajamukherji authored Jul 24, 2023
    Copy the full SHA
    7ded185 View commit details
Showing with 280 additions and 106 deletions.
  1. +1 −1 src/ml_bytecode.c
  2. +22 −46 src/ml_compiler.c
  3. +11 −0 src/ml_compiler2.h
  4. +8 −4 src/ml_string.c
  5. +8 −4 src/ml_time.c
  6. +4 −2 src/ml_uuid.c
  7. +224 −49 src/ml_xml.c
  8. +2 −0 src/ml_xml.h
2 changes: 1 addition & 1 deletion src/ml_bytecode.c
Original file line number Diff line number Diff line change
@@ -1836,8 +1836,8 @@ void ml_closure_info_list(ml_stringbuffer_t *Buffer, ml_closure_info_t *Info) {
Inst = Inst[1].Inst;
} else {
Inst += ml_closure_inst_list(Inst, Buffer);
ml_stringbuffer_put(Buffer, '\n');
}
ml_stringbuffer_put(Buffer, '\n');
}
}

68 changes: 22 additions & 46 deletions src/ml_compiler.c
Original file line number Diff line number Diff line change
@@ -901,6 +901,9 @@ void ml_suspend_expr_compile(mlc_function_t *Function, mlc_parent_expr_t *Expr,
Frame->Expr = Expr;
Frame->Flags = Flags;
mlc_expr_t *Child = Expr->Child;
if (!Child) {
MLC_EXPR_ERROR(Expr, ml_error("CompilerError", "Empty susp expression"));
}
if (Child->Next) {
Frame->Child = Child->Next;
return mlc_compile(Function, Child, MLCF_PUSH);
@@ -2310,17 +2313,17 @@ void ml_const_call_expr_compile(mlc_function_t *Function, mlc_parent_value_expr_

typedef struct {
mlc_expr_t *Guard;
ml_call_expr_frame_t *Caller;
int OldIt;
} ml_guard_expr_frame_t;

static void ml_guard_expr_compile3(mlc_function_t *Function, ml_value_t *Value, ml_guard_expr_frame_t *Frame) {
Function->It = Frame->OldIt;
MLC_POP();
ml_call_expr_frame_t *Caller = (ml_call_expr_frame_t *)&Function->Frame->Data;
ml_inst_t *CheckInst = MLC_EMIT(Frame->Guard->EndLine, MLI_AND_POP, 2);
CheckInst[2].Count = Caller->Index + 1;
CheckInst[1].Inst = Caller->NilInst;
Caller->NilInst = CheckInst + 1;
CheckInst[2].Count = Frame->Caller->Index + 1;
CheckInst[1].Inst = Frame->Caller->NilInst;
Frame->Caller->NilInst = CheckInst + 1;
MLC_RETURN(NULL);
}

@@ -2332,17 +2335,15 @@ static void ml_guard_expr_compile2(mlc_function_t *Function, ml_value_t *Value,
}

void ml_guard_expr_compile(mlc_function_t *Function, mlc_parent_expr_t *Expr, int Flags) {
if (Function->Frame->run == (mlc_frame_fn)ml_call_expr_compile4) {
MLC_FRAME(ml_guard_expr_frame_t, ml_guard_expr_compile2);
Frame->Guard = Expr->Child->Next;
return mlc_compile(Function, Expr->Child, MLCF_PUSH);
} else if (Function->Frame->run == (mlc_frame_fn)ml_call_expr_compile5) {
MLC_FRAME(ml_guard_expr_frame_t, ml_guard_expr_compile2);
Frame->Guard = Expr->Child->Next;
return mlc_compile(Function, Expr->Child, MLCF_PUSH);
} else {
if ((Function->Frame->run != (mlc_frame_fn)ml_call_expr_compile4) &&
(Function->Frame->run != (mlc_frame_fn)ml_call_expr_compile5)) {
MLC_EXPR_ERROR(Expr, ml_error("CompilerError", "Guard expression used outside of function call"));
}
ml_call_expr_frame_t *Caller = (ml_call_expr_frame_t *)Function->Frame->Data;
MLC_FRAME(ml_guard_expr_frame_t, ml_guard_expr_compile2);
Frame->Guard = Expr->Child->Next;
Frame->Caller = Caller;
return mlc_compile(Function, Expr->Child, MLCF_PUSH);
}

static void ml_tuple_expr_compile2(mlc_function_t *Function, ml_value_t *Value, mlc_parent_expr_frame_t *Frame) {
@@ -2373,6 +2374,7 @@ void ml_tuple_expr_compile(mlc_function_t *Function, mlc_parent_expr_t *Expr, in
int Count = 0;
for (mlc_expr_t *Child = Expr->Child; Child; Child = Child->Next) ++Count;
Frame->Count = Count;
Frame->NilInst = NULL;
Frame->Flags = Flags;
ml_inst_t *LoadInst = MLC_EMIT(Expr->StartLine, MLI_LOAD, 1);
LoadInst[1].Value = (ml_value_t *)MLTupleT;
@@ -2442,6 +2444,7 @@ void ml_list_expr_compile(mlc_function_t *Function, mlc_parent_expr_t *Expr, int
int Count = 0;
for (mlc_expr_t *Child = Expr->Child; Child; Child = Child->Next) ++Count;
Frame->Count = Count;
Frame->NilInst = NULL;
Frame->Flags = Flags;
ml_inst_t *LoadInst = MLC_EMIT(Expr->StartLine, MLI_LOAD, 1);
LoadInst[1].Value = (ml_value_t *)MLListOfArgs;
@@ -2507,6 +2510,7 @@ void ml_map_expr_compile(mlc_function_t *Function, mlc_parent_expr_t *Expr, int
int Count = 0;
for (mlc_expr_t *Child = Expr->Child; Child; Child = Child->Next) ++Count;
Frame->Count = Count;
Frame->NilInst = NULL;
Frame->Flags = Flags;
ml_inst_t *LoadInst = MLC_EMIT(Expr->StartLine, MLI_LOAD, 1);
LoadInst[1].Value = (ml_value_t *)MLMapOfArgs;
@@ -3953,19 +3957,9 @@ void ml_parser_special(ml_parser_t *Parser, ml_value_t *(*Special)(void *), void
Parser->SpecialData = Data;
}

typedef enum {
EXPR_SIMPLE,
EXPR_AND,
EXPR_OR,
EXPR_FOR,
EXPR_DEFAULT
} ml_expr_level_t;

static int ml_parse(ml_parser_t *Parser, ml_token_t Token);
static void ml_accept(ml_parser_t *Parser, ml_token_t Token);
static mlc_expr_t *ml_parse_expression(ml_parser_t *Parser, ml_expr_level_t Level);
static mlc_expr_t *ml_accept_term(ml_parser_t *Parser, int MethDecl);
static mlc_expr_t *ml_accept_expression(ml_parser_t *Parser, ml_expr_level_t Level);
static void ml_accept_arguments(ml_parser_t *Parser, ml_token_t EndToken, mlc_expr_t **ArgsSlot);

static inline uint8_t ml_nibble(ml_parser_t *Parser, char C) {
@@ -4388,28 +4382,10 @@ static ml_token_t ml_scan(ml_parser_t *Parser) {
return Parser->Token;
}
const char *Ident = ml_ident(Next, Length);
//char *Ident = snew(Length + 1);
//memcpy(Ident, Next, Length);
//Ident[Length] = 0;
if (End[0] == '\"') {
if (End[0] == '\"' || End[0] == '\'') {
Parser->Ident = Ident;
Parser->Token = MLT_ESCAPE;
Parser->Next = End + 1;
/*string_fn_t StringFn = stringmap_search(StringFns, Ident);
if (!StringFn) {
ml_parse_warn(Parser, "ParseError", "Unknown string prefix: %s", Ident);
StringFn = ml_string;
}
Parser->Next = End + 1;
int Length = ml_scan_raw_string(Parser);
ml_value_t *Value = StringFn(Parser->Ident, Length);
if (ml_is_error(Value)) {
ml_error_trace_add(Value, Parser->Source);
Parser->Value = Value;
longjmp(Parser->OnError, 1);
}
Parser->Value = Value;
Parser->Token = MLT_VALUE;*/
Parser->Next = End;
return Parser->Token;
}
Parser->Next = End;
@@ -4642,7 +4618,7 @@ static inline int ml_parse2(ml_parser_t *Parser, ml_token_t Token) {
}
}

static void ml_accept(ml_parser_t *Parser, ml_token_t Token) {
void ml_accept(ml_parser_t *Parser, ml_token_t Token) {
if (ml_parse2(Parser, Token)) return;
if (Parser->Token == MLT_IDENT) {
ml_parse_warn(Parser, "ParseError", "Expected %s not %s (%s)", MLTokens[Token], MLTokens[Parser->Token], Parser->Ident);
@@ -5516,7 +5492,7 @@ static mlc_expr_t *ml_parse_factor(ml_parser_t *Parser, int MethDecl) {
case MLT_SUSP: {
ml_next(Parser);
ML_EXPR(SuspendExpr, parent, suspend);
SuspendExpr->Child = ml_parse_expression(Parser, EXPR_DEFAULT);
SuspendExpr->Child = ml_accept_expression(Parser, EXPR_DEFAULT);
if (ml_parse(Parser, MLT_COMMA)) {
SuspendExpr->Child->Next = ml_accept_expression(Parser, EXPR_DEFAULT);
}
@@ -5903,7 +5879,7 @@ static mlc_expr_t *ml_parse_expression(ml_parser_t *Parser, ml_expr_level_t Leve
return Expr;
}

static mlc_expr_t *ml_accept_expression(ml_parser_t *Parser, ml_expr_level_t Level) {
mlc_expr_t *ml_accept_expression(ml_parser_t *Parser, ml_expr_level_t Level) {
ml_skip_eol(Parser);
mlc_expr_t *Expr = ml_parse_expression(Parser, Level);
if (!Expr) {
11 changes: 11 additions & 0 deletions src/ml_compiler2.h
Original file line number Diff line number Diff line change
@@ -71,6 +71,17 @@ typedef enum {
MLT_METHOD
} ml_token_t;

typedef enum {
EXPR_SIMPLE,
EXPR_AND,
EXPR_OR,
EXPR_FOR,
EXPR_DEFAULT
} ml_expr_level_t;

void ml_accept(ml_parser_t *Parser, ml_token_t Token);
mlc_expr_t *ml_accept_expression(ml_parser_t *Parser, ml_expr_level_t Level);

typedef struct mlc_function_t mlc_function_t;
typedef struct mlc_frame_t mlc_frame_t;
typedef struct mlc_loop_t mlc_loop_t;
12 changes: 8 additions & 4 deletions src/ml_string.c
Original file line number Diff line number Diff line change
@@ -3848,8 +3848,10 @@ ml_value_t *ml_regexi(const char *Pattern0, int Length) {
}

static ml_value_t *ml_parser_escape_regex(ml_parser_t *Parser) {
const char *Next = ml_parser_clear(Parser), *End = Next;
while (End[0] != '\"') {
const char *Next = ml_parser_clear(Parser);
char Quote = *Next++;
const char *End = Next;
while (End[0] != Quote) {
if (!End[0]) {
ml_parse_warn(Parser, "ParseError", "End of input while parsing string");
break;
@@ -3874,8 +3876,10 @@ static ml_value_t *ml_parser_escape_regex(ml_parser_t *Parser) {
}

static ml_value_t *ml_parser_escape_regexi(ml_parser_t *Parser) {
const char *Next = ml_parser_clear(Parser), *End = Next;
while (End[0] != '\"') {
const char *Next = ml_parser_clear(Parser);
char Quote = *Next++;
const char *End = Next;
while (End[0] != Quote) {
if (!End[0]) {
ml_parse_warn(Parser, "ParseError", "End of input while parsing string");
break;
12 changes: 8 additions & 4 deletions src/ml_time.c
Original file line number Diff line number Diff line change
@@ -104,8 +104,10 @@ ml_value_t *ml_time_parse(const char *Value, int Length) {
}

ml_value_t *ml_parser_escape_time(ml_parser_t *Parser) {
const char *Next = ml_parser_clear(Parser), *End = Next;
while (End[0] != '\"') {
const char *Next = ml_parser_clear(Parser);
char Quote = *Next++;
const char *End = Next;
while (End[0] != Quote) {
if (!End[0]) {
ml_parse_warn(Parser, "ParseError", "End of input while parsing string");
break;
@@ -626,8 +628,10 @@ static ml_value_t *ml_time_zone_parse(const char *Id, int Length) {
}

ml_value_t *ml_parser_escape_time_zone(ml_parser_t *Parser) {
const char *Next = ml_parser_clear(Parser), *End = Next;
while (End[0] != '\"') {
const char *Next = ml_parser_clear(Parser);
char Quote = *Next++;
const char *End = Next;
while (End[0] != Quote) {
if (!End[0]) {
ml_parse_warn(Parser, "ParseError", "End of input while parsing string");
break;
6 changes: 4 additions & 2 deletions src/ml_uuid.c
Original file line number Diff line number Diff line change
@@ -35,8 +35,10 @@ ml_value_t *ml_uuid_parse(const char *Value, int Length) {
}

ml_value_t *ml_parser_escape_uuid(ml_parser_t *Parser) {
const char *Next = ml_parser_clear(Parser), *End = Next;
while (End[0] != '\"') {
const char *Next = ml_parser_clear(Parser);
char Quote = *Next++;
const char *End = Next;
while (End[0] != Quote) {
if (!End[0]) {
ml_parse_warn(Parser, "ParseError", "End of input while parsing string");
break;
Loading