ClojureScript

cljs.reader parses radix form of int literals (e.g. 2r101) incorrectly

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test

Description

ClojureScript:cljs.user> (cljs.reader/read-string "2r10")
"Error evaluating:" (cljs.reader/read-string "2r10") :as "cljs.reader.read_string.call(null,\"2r10\")"
org.mozilla.javascript.JavaScriptException: Error: Invalid number format [2r10] (file:/Users/favila/wcs/clojurescript/.repl/cljs/reader.js#107)
	at file:/Users/favila/wcs/clojurescript/.repl/cljs/reader.js:107 (anonymous)
	at file:/Users/favila/wcs/clojurescript/.repl/cljs/reader.js:112 (anonymous)
	at file:/Users/favila/wcs/clojurescript/.repl/cljs/reader.js:374 (read_number)
	at file:/Users/favila/wcs/clojurescript/.repl/cljs/reader.js:650 (read)
	at file:/Users/favila/wcs/clojurescript/.repl/cljs/reader.js:677 (read_string)
	at <cljs repl>:1 (anonymous)
	at <cljs repl>:1
  1. cljs-775.patch
    10/May/14 11:36 AM
    5 kB
    Francis Avila
  2. cljs-775-initial.patch
    28/Feb/14 1:42 AM
    5 kB
    Francis Avila

Activity

Hide
Francis Avila added a comment -

Turns out other integer literals were broken besides radix due to a re-match problem (CLJS-776). Patch includes fix and tests for all the different integer literal forms.

Floats, ratios, and symbols/keywords might also have parsed incorrectly in certain cases, but I did not produce failing tests to confirm.

Show
Francis Avila added a comment - Turns out other integer literals were broken besides radix due to a re-match problem (CLJS-776). Patch includes fix and tests for all the different integer literal forms. Floats, ratios, and symbols/keywords might also have parsed incorrectly in certain cases, but I did not produce failing tests to confirm.
Hide
David Nolen added a comment -

Can we get a new patch rebased on master? Thanks!

Show
David Nolen added a comment - Can we get a new patch rebased on master? Thanks!
Hide
Francis Avila added a comment -

Rebased patch.

Show
Francis Avila added a comment - Rebased patch.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: