Comments (4)
For this there is two solutions:
- enclose the variable used during the transformation:
diff --git a/tools/generator.sh b/tools/generator.sh
index e020fe0..66c0754 100755
--- a/tools/generator.sh
+++ b/tools/generator.sh
@@ -17,7 +17,7 @@
echo "#define JERRY_MCU_SCRIPT \\" > $2
cat $1 | while read line
do
- line=$(echo $line | sed 's/"/\\"/g')
+ line=$(echo "$line" | sed 's/"/\\"/g')
echo "\"$line\n\" \\" >> $2
done
echo >> $2
- Rewrite the whole thing with sed:
diff --git a/tools/generator.sh b/tools/generator.sh
index e020fe0..ee0ff47 100755
--- a/tools/generator.sh
+++ b/tools/generator.sh
@@ -15,9 +15,5 @@
# limitations under the License.
echo "#define JERRY_MCU_SCRIPT \\" > $2
-cat $1 | while read line
-do
- line=$(echo $line | sed 's/"/\\"/g')
- echo "\"$line\n\" \\" >> $2
-done
+sed 's/"/\\"/g' $1 | sed 's/^.*$/"\0" \\/g' >> $2
echo >> $2
There will be a bit difference in the 2nd case as it will leave any trailing/leading whitespaces intact.
Which solution would be better?
from jerryscript.
@galpeter ,
it seems that leaving whitespaces exactly as they were in source script is better.
from jerryscript.
BTW, if someone can propose the better solution than usage of this script, I'd prefer it.
from jerryscript.
Fix is merged as #200
from jerryscript.
Related Issues (20)
- ICE: Assertion 'ecma_is_lexical_environment (obj_p) || !ecma_op_object_is_fast_array (obj_p)' failed at jerry-core/ecma/base/ecma-helpers.c
- SEGV ./jerry-core/ecma/base/ecma-helpers.c:238:58
- SEGV ./jerry-core/jmem/jmem-poolman.c:136:29 in jmem_pools_free
- Who to contact for security issues
- Segmentation Fault in release. Assertion 'context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION' failed on debug.
- Segmentation Fault in release. Assertion 'context_p->source_p < context_p->source_end_p' failed in debug version
- link error when build jerry.exe on MSYS2 MinGW64
- Assertion 'opts & PARSER_CLASS_LITERAL_CTOR_PRESENT' failed at /jerryscript/jerry-core/parser/js/js-parser-expr.c(parser_parse_class_body):538
- SEGV /jerryscript/jerry-core/vm/vm.c:1648:55 in vm_loop
- Not feasible to update some CI jobs to ubuntu 22.04 HOT 2
- Need a Bytecode Viewer, a tool to read Bytecode HOT 1
- Memory corruption in parser_parse_class
- Assertion 'ecma_is_value_object (iter_result)' failed
- Assertion 'context_p->next_scanner_info_p->source_p == context_p->source_p && context_p->next_scanner_info_p->type == SCANNER_TYPE_SWITCH' failed
- Snapshot doesn't support tagged template literals HOT 1
- RegExp.rightContext differs between Jerryscript and V8
- request a new release
- Online API reference docs doesn't match github's. HOT 1
- How to ensure that arguments of c method are not destroyed after the execution of the function HOT 2
- A memory leak defect was identified at line 151 of the file /jerryscript/jerry-ext/util/sources.c.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jerryscript.