Test rouge highlighter

This commit is contained in:
Evgeny Gavrin
2015-06-14 14:21:17 +03:00
parent 8f615e3732
commit dd508c8113
4 changed files with 33 additions and 31 deletions
+24 -18
View File
@@ -6,10 +6,11 @@ permalink: /how-to/
# How to Get the Sources
This step should be simple:
{% highlight bash %}
```bash
git clone https://github.com/Samsung/jerryscript.git
cd jerryscript
{% endhighlight %}
```
# How to Setup Recommended Prerequisites
@@ -29,13 +30,13 @@ These tools are required for development:
- `cppcheck` requires `libpcre`
- `vera++` requires `tcl`, `tk` and `boost`
{% highlight bash %}
```bash
sudo apt-get install gcc g++
sudo apt-get install gcc-arm-none-eabi g++-arm-none-eabi
sudo apt-get install cmake
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install tcl8.6 tcl8.6-dev tk8.6-dev libboost-all-dev
{% endhighlight %}
```
To make our scripts run correctly, several shell utilities should be available the system:
@@ -49,9 +50,10 @@ To make our scripts run correctly, several shell utilities should be available t
# How to Build
After setting up prerequisites, let's built the engine:
{% highlight bash %}
```
make
{% endhighlight %}
```
Upon first build, `make` would try to setup prerequisites, required for further development and pre-commit testing:
- stm32f3 and stm32f4 libraries
@@ -60,32 +62,36 @@ Upon first build, `make` would try to setup prerequisites, required for further
- vera++ 1.2.1
It may take time, so go grab some coffee:
{% highlight bash %}
```bash
Setting up prerequisites... (log file: ./build/prerequisites/prerequisites.log)
{% endhighlight %}
```
## How to Build Debug Version
To build debug version for Linux:
{% highlight bash %}
```bash
make debug.linux
{% endhighlight %}
```
To build debug version for Linux without LTO (Link Time Optimization):
{% highlight bash %}
```bash
LTO=off make debug.linux
{% endhighlight %}
```
# How to Run Unittests
{% highlight bash %}
```bash
make unittests
{% endhighlight %}
```
# How to Check the Patch
{% highlight bash %}
```bash
make precommit -j
{% endhighlight %}
```
Sometimes pre-commit testing fails, in that case you'll see message like that:
{% highlight bash %}
```bash
Build failed. See ./build/bin/unittests/make.log for details.
{% endhighlight %}
```
+4 -10
View File
@@ -52,22 +52,16 @@ After every scope is processed, parser merges all scopes into single byte-code a
Two new entities were introduced - scopes and pre-parser.
* There are two types of scopes in the parser: global scope and function declaration scope. Notice that function expressions do not create a new scope in terms of the parser. A reason why is described below.
Parsing process starts on global scope. If a function declaration occurs string the process, new scope is created, this new scope is pushed to a stack of current scopes; then steps 1-3 of parsing are performed. Note, that only global scope parsing shall merge all scopes into a byte-code. All scopes are stored in a tree to represent a hierarchy of them.
* There are two types of scopes in the parser: global scope and function declaration scope. Notice that function expressions do not create a new scope in terms of the parser. A reason why is described below. Parsing process starts on global scope. If a function declaration occurs string the process, new scope is created, this new scope is pushed to a stack of current scopes; then steps 1-3 of parsing are performed. Note, that only global scope parsing shall merge all scopes into a byte-code. All scopes are stored in a tree to represent a hierarchy of them.
* Pre-parser. This step performs hoisting of variable declarations. First, it dumps `reg_var_decl` opcodes. Then it goes through the script and looks for variable declaration lists. For every found variable in the scope (not in a sub-scope or function expression) it dumps var_decl opcode. After this step byte-code in the scope starts with optional `'use strict'` marker, then `reg_var_decl` and several (optional) `var_decls`.
Due to some limitations of the parser, some parsing functions take `this_arg` and/or `prop` as parameters. They are further used to dump `prop_setter` opcode.
During parsing all necessary data is stored in either stacks or scope trees.
After parsing of whole program, the parser merges all scopes into a single byte-code, hoisting function declarations in process. This task, so-called post-parser, is performed by `scopes_tree_raw_data` (jerry-core/js/scopes-tree.c) function. For further information about post-parser, check opcodes dumper section.
Currently the parser does not support labeled statements and for-in loops.
Due to some limitations of the parser, some parsing functions take `this_arg` and/or `prop` as parameters. They are further used to dump `prop_setter` opcode. During parsing all necessary data is stored in either stacks or scope trees. After parsing of whole program, the parser merges all scopes into a single byte-code, hoisting function declarations in process. This task, so-called post-parser, is performed by `scopes_tree_raw_data` (jerry-core/js/scopes-tree.c) function. For further information about post-parser, check opcodes dumper section.
### Lexer
The lexer splits input string on set of tokens. The token structure (jerry-core/parser/js/lexer.h) consists of three elements: token type, location of the token and optional data:
```
``` c
typedef struct
{
locus loc;
+3 -1
View File
@@ -9,8 +9,10 @@ url: "http://samsung.github.io" # the base hostname & protocol for your site
#github_username: samsung
# Build settings
#markdown: kramdown
markdown: kramdown
highlighter: pygments
highlighter: rouge
kramdown:
input: GFM
syntax_highlighter: rouge
+2 -2
View File
@@ -9,13 +9,13 @@ JerryScript is a lightweight JavaScript engine intended to run on a very constra
- On-device compilation and execution
- The engine provides access to peripherals from JavaScript
{% highlight js %}
```js
print_hello("Tom")
function print_hello (name) {
print ("Hi, " + name)
}
{% endhighlight %}
```
Check out the [JerryScript sources][jerryscript] and start using JerryScript in you projects. Please, report all found bugs and request new features at [JerryScript issue tracker][jerryscript-issue]. If you have questions, feel free to ask them on [issue tracker][jerryscript-issue-questions] and don't forget to label it with `question` or `discussion`.