Code Monkey home page Code Monkey logo

hexpat-lsp's People

Contributors

calcoph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hexpat-lsp's Issues

Recognize '@' pattern inside functions.

The following pattern will print the first 4 bytes in imhex.
The language server will give an error: 'Missing ; [Ln5, Col 22]'

Below is a failing test for this behavior.

#include <std/io.pat>
#include <std/string.pat>

fn with_var() {
    u32 placementVar @ 0x00;
    std::print("variable {}", placementVar);
};

with_var();
#[test]
fn test_pattern_at_in_function() {
    let test_str = "
        fn func_with_at() {
            u32 contents @ 0x00;
        }
    ";

    let expected_output = Expr::ExprList {
        list: vec![ 
            (
                Expr::Func {
                    name: (String::from("func_with_at"), 0..0),
                    args: (vec![], 0..0),
                    body: spanbox!(Expr::ExprList {
                        list: vec![(
                            Expr::Definition {
                                value_type: (
                                    HexTypeDef {
                                        endianness: Endianness::Unkown,
                                        name: (HexType::V(ValueType::U32), 0..0),
                                    },
                                    0..0,
                                ),
                                name: blocal!("contents"),
                                body: bnum!(),
                            },
                            0..0,
                        )]
                    })
                },
                0..0,
            )
        ],
    };

    let includeable_folders = vec![
        String::from("~/.local/share/imhex"),
        String::from("/usr/share/imhex"),
        String::from("%localappdata%/imhex"),
        String::from("%programfiles%/imhex"),
    ];

    let ((ex, _), _, _) = parse(test_str, &includeable_folders);
    expr_comparer(&ex, &expected_output).unwrap()
}

Support for nested generics

If I write a patten like:

Foo<Bar<u8>> x@$;
Foo<Bar<Baz<u8,u16>>> y@$;

then imhex will happily accept it, but this tool treats it as a syntax error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.