You found a bug! We've classified it as SDKTOOLS-423 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Apr 2008
    Posts
    259
    Vote Rating
    26
    themightychris will become famous soon enough themightychris will become famous soon enough

      0  

    Default 3.0 -> 3.1, Rhino refuses to compile arbitrary leading commas

    3.0 -> 3.1, Rhino refuses to compile arbitrary leading commas


    I use leading commas in my class definitions -- not Sencha's preferred style but legitimate JS. Since upgrading to Sencha CMD 3.1, Rhino spits out an "invalid property id" parse error on a select few occurrences but is ok with most. If I move the few leading commas it doesn't like to the end of the previous statement it compiles fine, the syntax errors in between go away, and its fine with the rest of my leading commas.

    Was the rhino version changed in 3.1 or was it set to a stricter mode?

    Code:
    [ERR] C2000: Rhino Parse Error (invalid property id => 	,pushPath: function(url) {) -- null:6819960
    [ERR] C2000: Rhino Parse Error (syntax error => 	,pushUrl: function(url) {) -- null:6821560
    [ERR] C2000: Rhino Parse Error (syntax error => 		console.warn('app.pushUrl is deprecated, use Controller.pushPath instead');) -- null:6821669
    [ERR] C2000: Rhino Parse Error (syntax error => 	}) -- null:6821860
    [ERR] C2000: Rhino Parse Error (syntax error => });) -- null:6821960
    [ERR] C2000: Rhino Parse Error (invalid property id => 	,icon: {) -- null:7998460
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		'57': 'resources/icons/Icon.png') -- null:7998566
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'72': 'resources/icons/Icon~ipad.png') -- null:7998667
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'114': 'resources/icons/Icon@2x.png') -- null:7998768
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'144': 'resources/icons/Icon~ipad@2x.png') -- null:7998868
    [ERR] C2000: Rhino Parse Error (syntax error => 	,startupImage: {) -- null:7999160
    [ERR] C2000: Rhino Parse Error (syntax error => 		'320x460': 'resources/startup/320x460.jpg') -- null:7999271
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'640x920': 'resources/startup/640x920.png') -- null:7999372
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'768x1004': 'resources/startup/768x1004.png') -- null:7999473
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'748x1024': 'resources/startup/748x1024.png') -- null:7999573
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'1536x2008': 'resources/startup/1536x2008.png') -- null:7999674
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 		,'1496x2048': 'resources/startup/1496x2048.png') -- null:7999774
    [ERR] C2000: Rhino Parse Error (syntax error => 	,controllers: [) -- null:8000060
    [ERR] C2000: Rhino Parse Error (syntax error => 		,'Dashboard') -- null:8000261
    [ERR] C2000: Rhino Parse Error (syntax error => 	]) -- null:8002060
    [ERR] C2000: Rhino Parse Error (syntax error => 	,makeIpadSized: function() {) -- null:8005060
    [ERR] C2000: Rhino Parse Error (syntax error => 		Ext.getBody()) -- null:8005265
    [ERR] C2000: Rhino Parse Error (syntax error => 	,error: function() {) -- null:8006660
    [ERR] C2000: Rhino Parse Error (invalid return => 		return this.alert(message, title);) -- null:8009767
    [ERR] C2000: Rhino Parse Error (syntax error => 	}) -- null:8009860
    [ERR] C2000: Rhino Parse Error (syntax error => 	,alert: function(message, title) {) -- null:8012060
    [ERR] C2000: Rhino Parse Error (syntax error => 		Ext.Msg.alert(title || 'Update', message);) -- null:8012165
    [ERR] C2000: Rhino Parse Error (syntax error => 	}) -- null:8012260
    [ERR] C2000: Rhino Parse Error (syntax error => 	,onUpdated: function() {) -- null:8013760
    [ERR] C2000: Rhino Parse Error (syntax error => 		Ext.Msg.confirm() -- null:8013865
    [ERR] C2000: Rhino Parse Error (syntax error => 			"Application Update",) -- null:8013982
    [ERR] C2000: Rhino Parse Error (syntax error => 			"This application has just successfully been updated to the latest version. Reload now?",) -- null:80140150
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 			function(buttonId) {) -- null:8014181
    [ERR] C2000: Rhino Parse Error (missing ; before statement => 				if (buttonId === 'yes') {) -- null:8014287
    [ERR] C2000: Rhino Parse Error (syntax error => 					window.location.reload();) -- null:8014371
    [ERR] C2000: Rhino Parse Error (syntax error => 				}) -- null:8014463
    [ERR] C2000: Rhino Parse Error (syntax error => 		);) -- null:8014661
    [ERR] C2000: Rhino Parse Error (syntax error => 	}) -- null:8014760
    [ERR] C2000: Rhino Parse Error (syntax error => });) -- null:8014860
    [ERR] C2000: Rhino Parse Error (Compilation produced 39 syntax errors. => null) -- null:1
    In an application with over 200 class files, all using strictly leading commas, moving the following two commas cleared out all the above errors and allowed my application to build:

    Code:
    /*jslint browser: true, undef: true, white: false, laxbreak: true *//*global Ext*/
    
    /**
     * Provides {@link #method-pushPath} for controllers
     */
    Ext.define('Jarvus.override.app.PushPath', {
            override: 'Ext.app.Controller'
            ,requires: [
                    'Ext.app.Action'
                    ,'Jarvus.override.app.EncodedPaths'
            ],
    
            /**
             * Silently push a given path to the address bar without triggering a routing event.
             * This is useful to call after a user has _already_ entered a UI state and the current address
             * _may_ need to be synchronized. If the given path was already in the address bar this method
             * has no effect.
             * 
             * @param {String/String[]/Ext.data.Model} url The url path to push 
             */
            ,pushPath: function(url) {
    Code:
    Ext.application({
            name: 'MyApp'
            ,requires: [
                    'Ext.MessageBox'
                    ,'Jarvus.override.app.EncodedPaths'
                    ,'Jarvus.override.app.PushPath'
                    ,'Jarvus.override.nav.CardAnimation'
            ],
    
    //    ,viewport: {
    //        autoMaximize: true // doesn't seem to have any impact on iPad
    //    }
            ,icon: {
                    '57': 'resources/icons/Icon.png'
                    ,'72': 'resources/icons/Icon~ipad.png'
                    ,'114': 'resources/icons/Icon@2x.png'
                    ,'144': 'resources/icons/Icon~ipad@2x.png'
            }
    Seems really arbitrary...

    UPDATE: Deleting any comments in-between the "requires" property and the first member seems to also resolve the parse error even without moving the comma
    Chief Architect @ Jarv.us Innovations
    Co-captain @ Code for Philly
    Co-founder @ Devnuts - Philadelphia Hackerspace

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      -1  

    Default


    You are right, it's valid JavaScript (disgusting tho ) so I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Oct 2010
    Posts
    9
    Vote Rating
    1
    jeffthompson1971 is on a distinguished road

      0  

    Default Any ETA on a fix?

    Any ETA on a fix?


    I have NO interest in going through all my files and getting rid of the leading commas, as I sort of dig it that way. When will there be a patch?

  4. #4
    Sencha Premium Member
    Join Date
    May 2013
    Location
    Stevenage, United Kingdom
    Posts
    44
    Vote Rating
    0
    uzair.sheikh is on a distinguished road

      0  

    Default Simple fix

    Simple fix


    I had the similar large number of errors coming up related to Rhino Phrase Error and the reason was, as I developed my project using Architect, so architect didn't add a comma ( , ) after defining views and before the refs in my controller but architect doesn't complain about it (as it has created this structure by its own) but when building same app using cmd, it was coming up with large number of Rhino errors.

    view: [
    'Login'
    ], ==> This Comma
    refs: {
    }

    Uzair

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Location
    Russia, Moscow
    Posts
    12
    Vote Rating
    0
    jmaxt is on a distinguished road

      0  

    Default Same problem!

    Same problem!


    1. I have unpacked extjs framwork at D:\ext-4.2.1.883
    2. I have installed sencha cmd, version 3.1.2.342

    my actions:
    mkdir D:/workspace-ext
    cd D:\ext-4.2.1.883
    sencha generate workspace ../workspace-ext/
    cd ../workspace-ext/
    sencha -sdk ext/ generate app ramdoc-app-js ramdoc-app-js
    cd ramdoc-app-js/
    sencha app build

    I got error:
    [ERR] C2000: Rhino Parse Error (missing ; before statement => var ramdoc-app-js
    = ramdoc-app-js || {};) -- unknown-file:9970
    [ERR] C2000: Rhino Parse Error (Invalid assignment left-hand side. => if (!ramdo
    c-app-js.controller) ramdoc-app-js.controller = {};) -- unknown-file:100119
    [ERR] C2000: Rhino Parse Error (Invalid assignment left-hand side. => if (!ramdo
    c-app-js.view) ramdoc-app-js.view = {};) -- unknown-file:101107
    [ERR] C2000: Rhino Parse Error (Compilation produced 3 syntax errors. => null) -
    - unknown-file:1
    [ERR]
    [ERR] BUILD FAILED
    [ERR] com.sencha.exceptions.ExBuild: Failed to compress input
    [ERR]
    [ERR] Total time: 4 seconds
    [ERR] The following error occurred while executing this line:
    D:\workspace-ext\ramdoc-app-js\.sencha\app\build-impl.xml:591: The following err
    or occurred while executing this line:
    D:\workspace-ext\ramdoc-app-js\.sencha\app\build-impl.xml:551: com.sencha.except
    ions.ExBuild: Failed to compress input

  6. #6
    Sencha User
    Join Date
    Aug 2013
    Posts
    2
    Vote Rating
    0
    0x29a is on a distinguished road

      0  

    Default Same problem here

    Same problem here


    Code:
    sencha app build
    will throw

    Code:
    [ERR] C2000: Rhino Parse Error (missing ; before statement => var sencha-generated = sencha-generated || {};) -- unknown-file:9970
    [ERR] C2000: Rhino Parse Error (Invalid assignment left-hand side. => if (!sencha-generated.controller) sencha-generated.controller = {};) -- unknown-file:100125
    [ERR] C2000: Rhino Parse Error (Invalid assignment left-hand side. => if (!sencha-generated.view) sencha-generated.view = {};) -- unknown-file:101113
    [ERR] C2000: Rhino Parse Error (Compilation produced 3 syntax errors. => null) -- unknown-file:1
    on app generated using

    Code:
    sencha app generate
    Ext version: 4.2.1.883
    cmd version: 3.1.2.342

  7. #7
    Sencha User
    Join Date
    Aug 2013
    Posts
    2
    Vote Rating
    0
    0x29a is on a distinguished road

      0  

    Default


    My problem was caused by hyphen given in application name.

    Code:
    sencha app build
    will complete successfuly on application created using

    Code:
    sencha -sdk [path_to_sdk] generate app pwnzor pwnzor
    but will fail on

    Code:
    sencha -sdk [path_to_sdk] generate app omg-wtf omg-wtf

  8. #8
    Sencha User
    Join Date
    Nov 2011
    Location
    Russia, Moscow
    Posts
    12
    Vote Rating
    0
    jmaxt is on a distinguished road

      0  

    Default


    Thank you 0x29a .
    My ext's workspace was located in d:\ext-workspaces\.
    I moved it into D:\extworkspace, regenerate app (with name without "-") and he works.