Code Monkey home page Code Monkey logo

clojarse-js's People

Contributors

mattfenwick avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clojarse-js's Issues

parse dispatches to constructors

example:

#java.lang.String["abc"]

that is valid syntax for a call to a java constructor, or something defined with deftype or defrecord

make token errors easier to find

instead of leaving them in the tree, why not:

  • put them in a dictionary
  • yank them out of the tree, leaving a pointer to the dictionary

rationale: won't have to traverse the tree to find the errors. Can just look in the dictionary

implement parse tree syntax in a module

motivation: I'm using this syntax definition in multiple places (normal modules as well as test modules), might as well factor it out

description: somewhere between the CST -- b/c tree is "cleaned" -- and AST

bring back or migrate the symbol error-checking

was:

var symbol_pattern = /^([:]?)([^\d\/].*\/)?(\/|[^\d\/][^\/]*)$/;
// a translation of either of these two, which should be equivalent (from Java):
//   - [:]?([\\D&&[^/]].*/)?(/|[\\D&&[^/]][^/]*)
//   - [:]? ([^0-9/].*/)? (/|[^0-9/][^/]*)

// check for special error cases (maybe match against regex as in Clojure implementation)
// TODO this could go in Clolint instead
_checks = bind(get, function(chars) {
    console.log('chars -- ' + JSON.stringify(chars));
    if ( cs[cs.length - 1] === ':' ) {
        return cut('identifier may not end with a :', zero);
    }
    if ( cs.slice(1).indexOf('::') > -1 ) {
        return cut(':: is illegal in identifiers (except at beginning)', zero);
    }
    var match = cs.match(symbol_pattern);
    if ( match === null ) {
        return cut('invalid identifier for mysterious reasons', zero);
    } else if ( match[2] !== void 0 ) {
        var m = match[2];
        if ( m.slice(m.length - 2) === ':/' ) {
                return cut(':/ is sometimes illegal in identifiers', zero);
        }
    }
    return pure(null);
}),

specify AST for things nested under tokens

examples:

$ echo '1.2e+31 "\u1234 \n \12"' | node main.js
clojure at 1,1
  float at 1,1
    {"sign":null,"int":"1","decimal":"2","exponent":{"sign":"+","power":"31"},"suffix":null}
  string at 1,9
    {"value":[{"pos":[1,11],"kind":"unicode","value":"1234"}," ",{"pos":[1,18],"kind":"simple","value":"n"}," ",{"pos":[1,21],"kind":"octal","value":"12"}]}

the exponents in floats and the escapes in strings

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.