reactxpy 0.1.2__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {reactxpy-0.1.2/reactxpy.egg-info → reactxpy-0.1.3}/PKG-INFO +1 -1
  2. {reactxpy-0.1.2 → reactxpy-0.1.3/reactxpy.egg-info}/PKG-INFO +1 -1
  3. {reactxpy-0.1.2 → reactxpy-0.1.3}/setup.py +1 -1
  4. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/lexer.cpp +31 -5
  5. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/parser.cpp +9 -3
  6. {reactxpy-0.1.2 → reactxpy-0.1.3}/MANIFEST.in +0 -0
  7. {reactxpy-0.1.2 → reactxpy-0.1.3}/README.md +0 -0
  8. {reactxpy-0.1.2 → reactxpy-0.1.3}/pyproject.toml +0 -0
  9. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy/__init__.py +0 -0
  10. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy/cli.py +0 -0
  11. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy/create_app.py +0 -0
  12. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy.egg-info/SOURCES.txt +0 -0
  13. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy.egg-info/dependency_links.txt +0 -0
  14. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy.egg-info/entry_points.txt +0 -0
  15. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy.egg-info/not-zip-safe +0 -0
  16. {reactxpy-0.1.2 → reactxpy-0.1.3}/reactxpy.egg-info/top_level.txt +0 -0
  17. {reactxpy-0.1.2 → reactxpy-0.1.3}/setup.cfg +0 -0
  18. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/ast.h +0 -0
  19. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/generator.cpp +0 -0
  20. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/generator.h +0 -0
  21. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/lexer.h +0 -0
  22. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/linker.cpp +0 -0
  23. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/linker.h +0 -0
  24. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/main.cpp +0 -0
  25. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/parser.h +0 -0
  26. {reactxpy-0.1.2 → reactxpy-0.1.3}/src/test_parser.cpp +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reactxpy
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: ReactXPy compiler for web applications.
5
5
  Author: Anish Kumar
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reactxpy
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: ReactXPy compiler for web applications.
5
5
  Author: Anish Kumar
6
6
  Description-Content-Type: text/markdown
@@ -48,7 +48,7 @@ reactxpy_ext = Extension("reactxpy.dummy", sources=[])
48
48
 
49
49
  setup(
50
50
  name="reactxpy",
51
- version="0.1.2",
51
+ version="0.1.3",
52
52
  description="ReactXPy compiler for web applications.",
53
53
  long_description=long_description,
54
54
  long_description_content_type="text/markdown",
@@ -98,12 +98,38 @@ vector<Token> Lexer::tokenize(){
98
98
  }
99
99
 
100
100
  // STRING
101
- if(peek()=='"'){
102
- pos++;
101
+ if(peek() == '"' || peek() == '\'' || peek() == '`'){
102
+ char quote = peek();
103
+ bool isTriple = false;
104
+
105
+ if(pos + 2 < source.size() && peek(1) == quote && peek(2) == quote) {
106
+ isTriple = true;
107
+ pos += 3;
108
+ } else {
109
+ pos++;
110
+ }
111
+
103
112
  string v;
104
- while(peek()!='"' && peek()!='\0')
105
- v+=source[pos++];
106
- if(peek()=='"') pos++;
113
+ while(pos < source.size()){
114
+ if(isTriple){
115
+ if(pos + 2 < source.size() && peek() == quote && peek(1) == quote && peek(2) == quote){
116
+ pos += 3;
117
+ break;
118
+ }
119
+ } else {
120
+ if(peek() == quote) {
121
+ pos++;
122
+ break;
123
+ }
124
+ }
125
+
126
+ if(peek() == '\\' && pos + 1 < source.size()){
127
+ v += source[pos++];
128
+ v += source[pos++];
129
+ } else {
130
+ v += source[pos++];
131
+ }
132
+ }
107
133
  tokens.push_back({STRING,v});
108
134
  continue;
109
135
  }
@@ -111,9 +111,15 @@ FunctionNode Parser::parseFunction() {
111
111
 
112
112
  Token t = advance();
113
113
 
114
- // preserve strings
115
- if (t.type == STRING)
116
- body += "\"" + t.value + "\"";
114
+ // preserve strings (output as JS template literals to support multiline)
115
+ if (t.type == STRING) {
116
+ string escaped;
117
+ for(char c : t.value) {
118
+ if(c == '`') escaped += "\\`";
119
+ else escaped += c;
120
+ }
121
+ body += "`" + escaped + "`";
122
+ }
117
123
  else
118
124
  body += t.value;
119
125
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes