Giter Site home page Giter Site logo

Comments (2)

developedby avatar developedby commented on September 3, 2024

I think the easiest and most flexible way would be to lex to this token structure

struct Token {
  Char(char),
  LineBreak,
  Begin,
  End,
}

Which keeps the text identical but consumes all whitespaces and converts it into just the indentation information. We could swap between the two behaviours by just flipping a flag in the lexer that tells it whether or not to generate the non-text tokens.

I think with this the conversion of our current parser is pretty trivial since all the text searching stays the same, we just need to change starts_with and consume to use char tokens instead of chars.

I'm not sure what VirtualSemi is in your example.

from bend.

imaqtkatt avatar imaqtkatt commented on September 3, 2024

Here VirtualSemi will be produced between lexemes starting in the same column, the example input can be read as:

test {
  wow {
    lol yay;
    bend
  }
  ok
}

from bend.

Related Issues (20)

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.