GithubHelp home page GithubHelp logo

luau-ast's Introduction

A TypeScript-to-Luau Compiler for Roblox

Discord server CI Status Coverage Status
ย 

Introduction

roblox-ts is an attempt to bridge the abilities of TypeScript to work in a Roblox environment. We break down your code into an abstract syntax tree and emit functionally similar structures in Luau so that the code behaves the same.

Quick start & Documentation

Ready to dive in? Check out the documentation.

Join the Community!

https://discord.roblox-ts.com

Games that use roblox-ts

luau-ast's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

luau-ast's Issues

Unicode escape codes in template literal strings are improperly sanitized

When using unicode escape codes (\u{XXXX}) in template literal strings, the compiler escapes the curly braces when it shouldn't resulting in malformed escape sequences.

Example Source Code

const string_a = "\u{E000}";
const string_b = `\u{E000}`;

Expected Emit

local string_a = "\u{E000}"
local string_b = `\u{E000}`

Actual Emit

local string_a = "\u{E000}"
local string_b = `\u\{E000\}` -- throws!

Playground Link

Unit test for `First*` and `Last*` enums

https://github.com/roblox-ts/luau-ast/blob/master/src/LuauAST/impl/enums.ts#L51-L58

It's easy to accidentally break these. So we should add a quick unit test which verifies:

assert(SyntaxKind.FirstIndexableExpression === 0);
assert(SyntaxKind.FirstExpression === 0);
// TODO: verify SyntaxKind.LastIndexableExpression?
assert(SyntaxKind.LastExpression + 1 === SyntaxKind.FirstStatement);
assert(SyntaxKind.LastStatement + 1 === SyntaxKind.FirstField);
assert(SyntaxKind.LastField === Math.max(...Object.values(SyntaxKind).filter((v): v is number => typeof v === "number")));

playground

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.