Problem description
When using the ' \ ' character in some text defined in the styles .tss files, Alloy compiler fails instead of ignoring it.
If setting it in the view .xml (for example as a Label text), the \ character is ignored as expected.
Steps to reproduce
1. Use following sample
index.xml
<Alloy>
<Window>
<Label top=5 id='topLabel'></Label>
<View id='mainview'>
<Label id='label'>foo \ bar</Label>
</View>
</Window>
</Alloy>
app.tss
"Label":{
font:{
fontSize:'18dp'
}
}
"#topLabel":{
text:'foo \ bar'
}
2. Build and run (any platform/device)
Result: Alloy compile fails.
[INFO] : ----- MVC GENERATION -----
[INFO] : [app.tss] global style processing...
[ERROR] : [ERROR] Error processing style "/Users/fcasali/Documents/Appcelerator_Studio_Workspace_5/alloySamples/app/styles/app.tss"
[ERROR] : [ERROR] Expected "Alloy", "L", "Ti", "Titanium", "WPATH", "[", "false", "null", "true", "{", comment, end of line, number, string or whitespace but "'" found.
[ERROR] : [ERROR]
[ERROR] : [ERROR] - line: 9
[ERROR] : [ERROR] - column: 7
[ERROR] : [ERROR] - offset: 64
[ERROR] : Alloy compiler failed
3. Change
text:'foo \ bar'
to
text:"foo \ bar"
and build.
Result: Alloy compile fails with a slightly different error.
[ERROR] : [ERROR] Expected "Alloy", "L", "Ti", "Titanium", "WPATH", "[", "false", "null", "true", "{", comment, end of line, number, string or whitespace but "\"" found.
4. Delete text:"foo \ bar" from app.tss and build (leave the one in index.xml)
Result: Alloy compiles and app is run. '\' is ignored.
Note
It is also reproducible with previous versions of Alloy, not a regression.
PR: https://github.com/appcelerator/alloy/pull/467 Test app: https://github.com/feons/alloy/tree/ALOY-793/test/apps/testing/ALOY-793 Functional Test: 1. Run the test app on iOS 2. No compile error and backslash shows up
PR reviewed and merged
Verified fixed on iPad iOS 8, Android 4.3 and Mobileweb. TiSDK 3.4.0.v20140911135715 Appcelerator Studio 3.4.0.201409111151 CLI 3.4.0-rc2 Alloy 1.5.0-rc Xcode6-beta7 Closing.