Code Monkey home page Code Monkey logo

Comments (6)

SoniEx2 avatar SoniEx2 commented on June 29, 2024

What about Lua5.3-compatible \u{XXX} where XXX is a sequence of 1 or more hexadecimal digits representing the character code point?

from luajit.

MikePall avatar MikePall commented on June 29, 2024

Maybe in addition. And, yes, I think this is just another pointless and stupid Lua 5.3 weirdness. Why should one be bothered to enter raw UTF-8 as hex values with \u{abcd}?!? This can already be entered as \xab\xcd -- that proprietary \u{} syntax doesn't help at all.

The point is to be able to enter or cut'n'paste a hex code point literally, not having to convert it to UTF-8 by hand. What an ill-conceived 'feature'.

Following the lead of Python, Java, Javascript etc. and implementing \u and \U just makes so much more sense.

from luajit.

fperrad avatar fperrad commented on June 29, 2024

I've already implemented this lexer extension in TvmJIT

see https://github.com/fperrad/tvmjit/blob/master/src/tj_lex.c#L171

from luajit.

SoniEx2 avatar SoniEx2 commented on June 29, 2024

This can already be entered as \xab\xcd -- that proprietary \u{} syntax doesn't help at all.

"\u{ABCD}" == "\xEA\xAF\x8D", NOT "\xAB\xCD".
Also "\u{0}" == "\0" and "\u{10301}" == "\xF0\x90\x8C\x81". It's variable-length so you don't need to have to handle \u and \U separately, you can just handle both.

The point is to be able to enter or cut'n'paste a hex code point literally, not having to convert it to UTF-8 by hand.

Exactly. Lua 5.3 also removes the need to add padding πŸ˜‰

from luajit.

DemiMarie avatar DemiMarie commented on June 29, 2024

Rust also uses the "\u{ABCD}"-style escapes. These have the advantages mentioned above.

I am going to try this.

from luajit.

MikePall avatar MikePall commented on June 29, 2024

Thanks! Applied to my git master (with modifications).

from luajit.

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.