~ntgg/zosh

3ebef2261eb7de9f350e19c121f2cafad24b0265 — Noah Graff 8 months ago 4ac7c65
renamed Symbol.Id.D variants to Double variants
1 files changed, 17 insertions(+), 17 deletions(-)

M src/tokenizer.zig
M src/tokenizer.zig => src/tokenizer.zig +17 -17
@@ 21,13 21,13 @@ pub const Symbol = struct {
        OrIf,

        /// ;;
        DSemi,
        DoubleSemi,

        /// <<
        DLess,
        DoubleLess,

        /// >>
        DGreat,
        DoubleGreat,

        /// <&
        LessAnd,


@@ 39,7 39,7 @@ pub const Symbol = struct {
        LessGreat,

        /// <<-
        DLessDash,
        DoubleLessDash,

        /// >|
        Clobber,


@@ 189,14 189,14 @@ test "Tokenizer.nextSymbolId" {
    t.expectEqual(Symbol.Id.OrIf, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.OrIf, tokenizer.nextSymbolId());
    _ = text.read(2);
    t.expectEqual(Symbol.Id.DSemi, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DSemi, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleSemi, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleSemi, tokenizer.nextSymbolId());
    _ = text.read(2);
    t.expectEqual(Symbol.Id.DLess, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DLess, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleLess, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleLess, tokenizer.nextSymbolId());
    _ = text.read(2);
    t.expectEqual(Symbol.Id.DGreat, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DGreat, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleGreat, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleGreat, tokenizer.nextSymbolId());
    _ = text.read(2);
    t.expectEqual(Symbol.Id.LessAnd, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.LessAnd, tokenizer.nextSymbolId());


@@ 210,8 210,8 @@ test "Tokenizer.nextSymbolId" {
    t.expectEqual(Symbol.Id.Clobber, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.Clobber, tokenizer.nextSymbolId());
    _ = text.read(2);
    t.expectEqual(Symbol.Id.DLessDash, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DLessDash, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleLessDash, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleLessDash, tokenizer.nextSymbolId());
    _ = text.read(3);
    t.expectEqual(Symbol.Id.EndOfFile, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.EndOfFile, tokenizer.nextSymbolId());


@@ 350,7 350,7 @@ test "Tokenizer.readNextToken" {
        },
        tokenizer.readNextToken("operators").?,
    );
    t.expectEqual(Symbol.Id.DSemi, tokenizer.nextSymbolId());
    t.expectEqual(Symbol.Id.DoubleSemi, tokenizer.nextSymbolId());
}

const Operator = struct {


@@ 360,12 360,12 @@ const Operator = struct {

// order by text length long -> short.
const operators = [_]Operator{
    Operator{ .symbol_id = .DLessDash, .text = "<<-" },
    Operator{ .symbol_id = .DoubleLessDash, .text = "<<-" },
    Operator{ .symbol_id = .AndIf, .text = "&&" },
    Operator{ .symbol_id = .OrIf, .text = "||" },
    Operator{ .symbol_id = .DSemi, .text = ";;" },
    Operator{ .symbol_id = .DLess, .text = "<<" },
    Operator{ .symbol_id = .DGreat, .text = ">>" },
    Operator{ .symbol_id = .DoubleSemi, .text = ";;" },
    Operator{ .symbol_id = .DoubleLess, .text = "<<" },
    Operator{ .symbol_id = .DoubleGreat, .text = ">>" },
    Operator{ .symbol_id = .LessAnd, .text = "<&" },
    Operator{ .symbol_id = .GreatAnd, .text = ">&" },
    Operator{ .symbol_id = .LessGreat, .text = "<>" },