Browse Source
Conflicts: app.js etc/config/gcc-explorer.lud-ldnmg01.properties lib/asm.js lib/compile.js package.json static/asm-mode.js static/compiler.js test/test.jsdev/git-series/gccdum

86 changed files with 5082 additions and 11148 deletions
@ -1,4 +1,6 @@
|
||||
*.swp |
||||
/node_modules |
||||
.npm-updated |
||||
/.npm-updated |
||||
/.bower-updated |
||||
/out |
||||
*.heapsnapshot |
||||
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ProjectCodeStyleSettingsManager"> |
||||
<option name="PER_PROJECT_SETTINGS"> |
||||
<value> |
||||
<MarkdownNavigatorCodeStyleSettings> |
||||
<option name="RIGHT_MARGIN" value="72" /> |
||||
</MarkdownNavigatorCodeStyleSettings> |
||||
</value> |
||||
</option> |
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" /> |
||||
</component> |
||||
</project> |
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="CompilerConfiguration"> |
||||
<resourceExtensions /> |
||||
<wildcardResourcePatterns> |
||||
<entry name="!?*.java" /> |
||||
<entry name="!?*.form" /> |
||||
<entry name="!?*.class" /> |
||||
<entry name="!?*.groovy" /> |
||||
<entry name="!?*.scala" /> |
||||
<entry name="!?*.flex" /> |
||||
<entry name="!?*.kt" /> |
||||
<entry name="!?*.clj" /> |
||||
<entry name="!?*.aj" /> |
||||
</wildcardResourcePatterns> |
||||
<annotationProcessing> |
||||
<profile default="true" name="Default" enabled="false"> |
||||
<processorPath useClasspath="true" /> |
||||
</profile> |
||||
</annotationProcessing> |
||||
</component> |
||||
</project> |
@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager"> |
||||
<settings default="" /> |
||||
</component> |
@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<module type="WEB_MODULE" version="4"> |
||||
<component name="NewModuleRootManager"> |
||||
<component name="NewModuleRootManager" inherit-compiler-output="false"> |
||||
<content url="file://$MODULE_DIR$"> |
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> |
||||
</content> |
||||
<orderEntry type="inheritedJdk" /> |
||||
<orderEntry type="sourceFolder" forTests="false" /> |
||||
<orderEntry type="library" name="gcc-explorer node_modules" level="project" /> |
||||
</component> |
||||
</module> |
@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="JavaScriptLibraryMappings"> |
||||
<file url="file://$PROJECT_DIR$" libraries="{gcc-explorer node_modules}" /> |
||||
<file url="file://$PROJECT_DIR$" libraries="{gcc-explorer/node_modules}" /> |
||||
<file url="file://$PROJECT_DIR$/static/ext/golden-layout" libraries="{gcc-explorer/static/ext/golden-layout/node_modules}" /> |
||||
<includedPredefinedLibrary name="Node.js Core" /> |
||||
</component> |
||||
</project> |
@ -1,14 +0,0 @@
|
||||
<component name="libraryTable"> |
||||
<library name="gcc-explorer node_modules" type="javaScript"> |
||||
<properties> |
||||
<option name="frameworkName" value="node_modules" /> |
||||
<sourceFilesUrls> |
||||
<item url="file://$PROJECT_DIR$/node_modules" /> |
||||
</sourceFilesUrls> |
||||
</properties> |
||||
<CLASSES> |
||||
<root url="file://$PROJECT_DIR$/node_modules" /> |
||||
</CLASSES> |
||||
<SOURCES /> |
||||
</library> |
||||
</component> |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" /> |
||||
</project> |
@ -1,16 +0,0 @@
|
||||
In progress |
||||
----------- |
||||
|
||||
Currently in progress is the difference view. In order to achieve this we need two "compiler" views; an "A" and "B". I'm in the progress of splitting out all the compiler-specifics into a class of sorts in the mainline, as this is a sensible refactor anyway. In the "diffs" branch I'm sketching out the UI. |
||||
|
||||
Notes: |
||||
|
||||
* storage in both hash tag and in local storage need to change. Specifically they are too tied to the notion of a single compiler. |
||||
* should ensure backwards compatibility: store off some hash tags and test the decode to the same view in the new scheme. |
||||
* binary mode could be done by compiling to .o (with LTO as necessary) and then decoding result of `objdump -d -C /tmp/temp.o -l -M intel --insn-width=16` (for example). |
||||
|
||||
|
||||
NB |
||||
-- |
||||
|
||||
Bug with clicked URLs and race to get the list of compilers (null compiler) |
@ -1,18 +1,39 @@
|
||||
GCC Explorer |
||||
[](https://travis-ci.org/mattgodbolt/gcc-explorer) |
||||
[](https://www.codewake.com/p/compiler-explorer) |
||||
|
||||
Compiler Explorer |
||||
------------ |
||||
|
||||
GCC Explorer is an interactive compiler. The left-hand pane shows editable C/C++ code. The right, the assembly output of having compiled the code with a given compiler and settings. |
||||
Compiler Explorer is an interactive compiler. The left-hand pane shows editable C/C++/Rust/Go/D code. The right, the |
||||
assembly output of having compiled the code with a given compiler and settings. Multiple compilers are supported, and |
||||
the UI layout is configurable (the [Golden Layout](https://www.golden-layout.com/) library is used for this). |
||||
|
||||
Try out the [demo site][demo]! |
||||
Try out one of the demo sites: [C++][cpp], [Rust][rust], [D][d] or [Go][go]. |
||||
|
||||
[demo]: http://gcc.godbolt.org/ |
||||
[cpp]: https://gcc.godbolt.org/ "Compiler Explorer for C++" |
||||
[rust]: https://rust.godbolt.org/ "Compiler Explorer for Rust" |
||||
[d]: https://d.godbolt.org/ "Compiler Explorer for D" |
||||
[go]: https://go.godbolt.org/ "Compiler Explorer for Go" |
||||
|
||||
### Developing |
||||
|
||||
GCC Explorer is written in node. |
||||
Compiler Explorer is written in node.js. |
||||
|
||||
Assuming you have npm and node installed, simply running `make` ought to get you up and running with an Explorer |
||||
running on port 10240 on your local machine: http://localhost:10240/ |
||||
|
||||
The `Makefile` will automatically install all the third party libraries needed to run; using `npm` to install server-side |
||||
components and `bower` to install all the client-facing libraries. |
||||
|
||||
If you want to point it at your own GCC or similar binaries,either edit the |
||||
`etc/config/gcc-explorer.defaults.properties` or else make a new one with the name |
||||
`gcc-explorer.YOURHOSTNAME.properties`. The config system leaves a lot to be desired, |
||||
I'm working on porting [CCS](https://github.com/hellige/ccs-cpp) to javascript and then something more rational can be used. |
||||
|
||||
Assuming you have npm and node installed, simply running `make` ought to get you up and running with a GCC explorer running on port 10240 on your local machine: http://localhost:10240 |
||||
Feel free to raise an issue on [github](https://github.com/mattgodbolt/gcc-explorer/issues) or |
||||
[email me directly](mailto:matt@godbolt.org) for more help. |
||||
|
||||
If you want to point it at your own GCC or similar binaries, either edit the `etc/config/gcc-explorer.defaults.properties` or else make a new one with the name `gcc-explorer.YOURHOSTNAME.properties`. The config system leaves a lot to be desired, I'm working on porting [CCS](https://github.com/hellige/ccs-cpp) to javascript and then something more rational can be used. |
||||
### Credits |
||||
|
||||
Feel free to raise an issue on [github](https://github.com/mattgodbolt/gcc-explorer/issues) or [email me directly](mailto:matt@godbolt.org) for more help. |
||||
Compiler Explorer is maintained by [Matt Godbolt](http://xania.org). Multiple compiler and difference view was |
||||
implemented by [Gabriel Devillers](https://github.com/voxelf). |
||||
|
@ -0,0 +1,18 @@
|
||||
({ |
||||
appDir: "static", |
||||
baseUrl: ".", |
||||
dir: "out/dist", |
||||
generateSourceMaps: true, |
||||
preserveLicenseComments: false, |
||||
optimize: "uglify2", |
||||
removeCombined: true, |
||||
useStrict: true, |
||||
mainConfigFile: "static/main.js", |
||||
skipDirOptimize: true, |
||||
optimizeCss: "standard", |
||||
modules: [ |
||||
{ |
||||
name: "main" |
||||
} |
||||
] |
||||
}) |
@ -0,0 +1,31 @@
|
||||
{ |
||||
"name": "gcc-explorer", |
||||
"description": "Interactively investigate compiler output", |
||||
"main": "./app.js", |
||||
"authors": [ |
||||
"Matt Godbolt" |
||||
], |
||||
"license": "BSD-2-Clause", |
||||
"homepage": "https://github.com/mattgodbolt/gcc-explorer", |
||||
"private": true, |
||||
"ignore": [ |
||||
"**/.*", |
||||
"node_modules", |
||||
"bower_components", |
||||
"test", |
||||
"tests" |
||||
], |
||||
"dependencies": { |
||||
"codemirror": "CodeMirror#^5.17.0", |
||||
"requirejs": "^2.2.0", |
||||
"underscore": "^1.8.3", |
||||
"golden-layout": "^1.5.6", |
||||
"jquery": "^3.1.0", |
||||
"bootstrap": "^3.3.7", |
||||
"selectize": "^0.12.2", |
||||
"eventEmitter": "^5.1.0", |
||||
"lz-string": "^1.4.4", |
||||
"clipboard": "^1.5.12", |
||||
"raven-js": "^3.7.0" |
||||
} |
||||
} |
@ -0,0 +1,4 @@
|
||||
region=us-east-1 |
||||
tagKey=Name |
||||
tagValue=Sven |
||||
externalTestMode=true |
@ -0,0 +1,11 @@
|
||||
# Matt's home development computer |
||||
defaultCompiler=g54 |
||||
compilers=g54:g47:g48 |
||||
#compilers=localhost@20480 |
||||
compiler.g54.exe=/usr/bin/g++ |
||||
compiler.g54.name=g++ 5.4 |
||||
compiler.g47.exe=/usr/bin/g++-4.7 |
||||
compiler.g47.name=g++ 4.7 |
||||
compiler.g48.exe=/usr/bin/g++-4.8 |
||||
compiler.g48.name=g++ 4.8 |
||||
#compiler-wrapper=./c-preload/compiler-wrapper |
@ -1,14 +1,12 @@
|
||||
compilers=gdc44:gdc46:gdc49u:gdc49 |
||||
defaultCompiler=gdc49 |
||||
compiler.gdc44.exe=/usr/bin/gdc-4.4 |
||||
compiler.gdc44.alias=/usr/bin/gdc-4.4 |
||||
compiler.gdc44.name=gdc 4.4 (Ubuntu) |
||||
compiler.gdc46.exe=/usr/bin/gdc-4.6 |
||||
compiler.gdc46.alias=/usr/bin/gdc-4.6 |
||||
compiler.gdc46.name=gdc 4.6 (Ubuntu) |
||||
compiler.gdc49u.exe=/usr/bin/gdc-4.9 |
||||
compiler.gdc49u.alias=/usr/bin/gdc-4.9 |
||||
compiler.gdc49u.name=gdc 4.9 (Ubuntu) |
||||
compiler.gdc49.exe=/opt/x86_64-gdcproject-linux-gnu/bin/gdc |
||||
compilers=gdc48:gdc49:gdc52 |
||||
defaultCompiler=gdc52 |
||||
# URL compatibility... |
||||
compiler.gdc49.exe=/opt/gcc-explorer/gdc4.9.3/x86_64-pc-linux-gnu/bin/gdc |
||||
compiler.gdc49.alias=/opt/x86_64-gdcproject-linux-gnu/bin/gdc |
||||
compiler.gdc49.name=gdc 2.066.1 (4.9) |
||||
compiler.gdc49.name=gdc 4.9.3 |
||||
|
||||
compiler.gdc48.exe=/opt/gcc-explorer/gdc4.8.2/x86_64-gdcproject-linux-gnu/bin/gdc |
||||
compiler.gdc48.name=gdc 4.8.2 |
||||
|
||||
compiler.gdc52.exe=/opt/gcc-explorer/gdc5.2.0/x86_64-pc-linux-gnu/bin/gdc |
||||
compiler.gdc52.name=gdc 5.2.0 |
||||
|
@ -1,9 +1,11 @@
|
||||
# Settings overridden for Amazon EC2 instances that power http://*.godbolt.org/ |
||||
googleApiKey=AIzaSyAaz35KJv8DA0ABoime0fEIh32NmbyYbcQ |
||||
compileTimeoutMs=5000 |
||||
compiler-wrapper=./c-preload/compiler-wrapper |
||||
max-asm-size=8388608 |
||||
staticMaxAgeMs=600000 |
||||
staticMaxAgeMs=30000 |
||||
cacheMb=50 |
||||
clientGoogleAnalyticsEnabled=true |
||||
proxyRetries=300 |
||||
proxyRetryMs=500 |
||||
ravenUrl=https://8e4614f649ad4e3faf3e7e8827b935f9@sentry.io/102028 |
||||
|
@ -0,0 +1 @@
|
||||
ravenUrl=https://8e4614f649ad4e3faf3e7e8827b935f9@sentry.io/102028 |
@ -1,3 +1,4 @@
|
||||
language=C++ |
||||
clientURLShortener=google |
||||
rescanCompilerSecs=360 |
||||
ravenUrl=https://8e4614f649ad4e3faf3e7e8827b935f9@sentry.io/102028 |
||||
|
@ -1,32 +1,44 @@
|
||||
compilers=r170:r160:r150:r140:r130:r120:r110:r100:nightly:beta |
||||
defaultCompiler=r170 |
||||
compiler.r170.exe=/opt/rust-1.7.0/bin/rustc |
||||
compilers=r1110:r1100:r190:r180:r170:r160:r150:r140:r130:r120:r110:r100:nightly:beta |
||||
defaultCompiler=r1110 |
||||
compiler.r1110.exe=/opt/gcc-explorer/rust-1.11.0/bin/rustc |
||||
compiler.r1110.name=rustc 1.11.0 |
||||
compiler.r1110.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r1100.exe=/opt/gcc-explorer/rust-1.10.0/bin/rustc |
||||
compiler.r1100.name=rustc 1.10.0 |
||||
compiler.r1100.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r190.exe=/opt/gcc-explorer/rust-1.9.0/bin/rustc |
||||
compiler.r190.name=rustc 1.9.0 |
||||
compiler.r190.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r180.exe=/opt/gcc-explorer/rust-1.8.0/bin/rustc |
||||
compiler.r180.name=rustc 1.8.0 |
||||
compiler.r180.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r170.exe=/opt/gcc-explorer/rust-1.7.0/bin/rustc |
||||
compiler.r170.name=rustc 1.7.0 |
||||
compiler.r170.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r160.exe=/opt/rust-1.6.0/bin/rustc |
||||
compiler.r160.exe=/opt/gcc-explorer/rust-1.6.0/bin/rustc |
||||
compiler.r160.name=rustc 1.6.0 |
||||
compiler.r160.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r150.exe=/opt/rust-1.5.0/bin/rustc |
||||
compiler.r150.exe=/opt/gcc-explorer/rust-1.5.0/bin/rustc |
||||
compiler.r150.name=rustc 1.5.0 |
||||
compiler.r150.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r140.exe=/opt/rust-1.4.0/bin/rustc |
||||
compiler.r140.exe=/opt/gcc-explorer/rust-1.4.0/bin/rustc |
||||
compiler.r140.name=rustc 1.4.0 |
||||
compiler.r140.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r130.exe=/opt/rust-1.3.0/bin/rustc |
||||
compiler.r130.exe=/opt/gcc-explorer/rust-1.3.0/bin/rustc |
||||
compiler.r130.name=rustc 1.3.0 |
||||
compiler.r130.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r120.exe=/opt/rust-1.2.0/bin/rustc |
||||
compiler.r120.exe=/opt/gcc-explorer/rust-1.2.0/bin/rustc |
||||
compiler.r120.name=rustc 1.2.0 |
||||
compiler.r120.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r110.exe=/opt/rust-1.1.0/bin/rustc |
||||
compiler.r110.exe=/opt/gcc-explorer/rust-1.1.0/bin/rustc |
||||
compiler.r110.name=rustc 1.1.0 |
||||
compiler.r110.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.r100.exe=/opt/rust-1.0.0/bin/rustc |
||||
compiler.r100.exe=/opt/gcc-explorer/rust-1.0.0/bin/rustc |
||||
compiler.r100.name=rustc 1.0.0 |
||||
compiler.r100.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.nightly.exe=/opt/rust-nightly/bin/rustc |
||||
compiler.nightly.exe=/opt/gcc-explorer/rust-nightly/bin/rustc |
||||
compiler.nightly.name=rustc nightly (version varies) |
||||
compiler.nightly.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
compiler.beta.exe=/opt/rust-beta/bin/rustc |
||||
compiler.beta.exe=/opt/gcc-explorer/rust-beta/bin/rustc |
||||
compiler.beta.name=rustc beta (version varies) |
||||
compiler.beta.intelAsm=-Cllvm-args=--x86-asm-syntax=intel |
||||
|
@ -1,2 +1,6 @@
|
||||
http://localhost:10240/#%7B%22version%22%3A2%2C%22source%22%3A%22%23include%20%3Cxmmintrin.h%3E%5Cn%5Cnvoid%20f(__m128%20a%2C%20__m128%20b)%5Cn%7B%5Cn%20%20%2F%2F%20I%20am%20a%20walrus.%5Cn%7D%22%2C%22compiler%22%3A%22%2Fhome%2Fmgodbolt%2Fapps%2Fintel-icc-oss%2Fbin%2Ficc%22%2C%22options%22%3A%22-O3%20-std%3Dc%2B%2B0x%22%2C%22filterAsm%22%3A%7B%22labels%22%3Atrue%2C%22directives%22%3Atrue%7D%7D |
||||
http://lud-ldnmg01:10240/#%7B%22version%22%3A2%2C%22source%22%3A%22%23include%20%3Cxmmintrin.h%3E%5Cn%5Cnvoid%20f(__m128%20a%2C%20__m128%20b)%5Cn%7B%5Cn%20%20%2F%2F%20I%20am%20a%20walrus.%5Cn%7D%22%2C%22compiler%22%3A%22%2Fhome%2Fmgodbolt%2Fapps%2Fintel-icc-oss%2Fbin%2Ficc%22%2C%22options%22%3A%22-O3%20-std%3Dc%2B%2B0x%22%2C%22filterAsm%22%3A%7B%22labels%22%3Atrue%2C%22directives%22%3Atrue%7D%7D |
||||
-- should be icc, "-O3 -std=c++0x", all filters but comments |
||||
http://lud-ldnmg01:10240/#compilers:!((compiler:g7snapshot,options:'-std%3Dc%2B%2B1z+-O3+',source:'%23include+%3Cvector%3E%0A%0Astruct+Widget+%7B%0A++int+n%3B%0A++double+x,+y%3B%0A++Widget(const+Widget%26+o)+:+x(o.x),+y(o.y),+n(o.n)+%7B%7D%0A++Widget(int+n,+double+x,+double+y)+:+n(n),+x(x),+y(y)+%7B%7D%0A%7D%3B%0A%0Astd::vector%3CWidget%3E+vector%3B%0Aconst+int+N+%3D+1002%3B%0Adouble+a+%3D+0.1%3B%0Adouble+b+%3D+0.2%3B%0A%0Avoid+demo()+%7B%0A++vector.reserve(N)%3B%0A++for+(int+i+%3D+01%3B+i+%3C+N%3B+%2B%2Bi)%0A++%7B%0A%09Widget+w+%7Bi,+a,+b%7D%3B%0A%09vector.push_back(w)%3B+//+or+vector.push_back(std::move(w))%0A++%7D%0A%7D%0A%0Aint+main()%0A%7B%0A+%0A+%0A%7D%0A')),filterAsm:(colouriseAsm:!t,commentOnly:!t,directives:!t,intel:!t,labels:!t),version:3 |
||||
-- should be GCC 7, with widgets source. Binary mode off, all other labels on. -std=c++1z -O3 |
||||
http://lud-ldnmg01:10240/#compilers:!((compiler:g474,options:'',sourcez:PQKgBALgpgzhYHsBmYDGCC2AHATrGAlggHYB0pamGUx8AFlHmEgjmADY0DmEdAXACgAhiNFjxEyVOkzZw2QsVLl85WvVrVG7TolbdB7fsMmlx0xennLNsddu37Dy0%2BenXbwx8%2B7vPo/7OfoGaIMACAgS0YBhCUQAUUfBCOFyoADSUxHBodClgICApXABuAJRgAN4CYGB4EACuOMRgAIwATADcAgC%2BQAA)),filterAsm:(binary:!t,colouriseAsm:!t,commentOnly:!t,directives:!t,intel:!t,labels:!t),version:3 |
||||
-- should be 4.7.4, no options, binary, intel, colourise. |
||||
|
@ -1,5 +0,0 @@
|
||||
Reading symbols from /grid/opt/zindex/zq...done. |
||||
quit |
||||
Reading symbols from /grid/opt/zindex/zindex...done. |
||||
Quit |
||||
quit |
@ -0,0 +1,235 @@
|
||||
var fs = require('fs'), |
||||
child_process = require('child_process'), |
||||
temp = require('temp'), |
||||
path = require('path'), |
||||
Promise = require('promise'); |
||||
|
||||
function cleanAndGetIndexes(text) { |
||||
var addRules = { |
||||
name: "add", |
||||
openTag: "{+", |
||||
replaceOpenTag: "", |
||||
closeTag: "+}", |
||||
replaceCloseTag: "" |
||||
}; |
||||
var delRules = { |
||||
name: "del", |
||||
openTag: "[-", |
||||
replaceOpenTag: "", |
||||
closeTag: "-]", |
||||
replaceCloseTag: "" |
||||
}; |
||||
var rules = [addRules, delRules]; |
||||
|
||||
var TagTypeEnum = { |
||||
OPENING: 1, |
||||
CLOSING: 2 |
||||
}; |
||||
|
||||
function tagLookup(rules, text, pos) { |
||||
var seen = false; |
||||
var type = null; |
||||
var rule = null; |
||||
for (var i = 0; i < rules.length; i++) { |
||||
var candidateTag = text.slice(pos, pos + rules[i].openTag.length); |
||||
if (rules[i].openTag == candidateTag) { |
||||
seen = true; |
||||
type = TagTypeEnum.OPENING; |
||||
rule = i; |
||||
break; |
||||
} |
||||
candidateTag = text.slice(pos, pos + rules[i].closeTag.length); |
||||
if (rules[i].closeTag == candidateTag) { |
||||
seen = true; |
||||
type = TagTypeEnum.CLOSING; |
||||
rule = i; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return { |
||||
seen: seen, |
||||
rule: rule, |
||||
type: type |
||||
}; |
||||
} |
||||
|
||||
var finalText = ""; |
||||
var posInFinalText = 0; // character that is going to be treated
|
||||
// The position in the original text:
|
||||
var posInText = 0; // character that is going to be treated
|
||||
var StateEnum = { |
||||
OUTSIDE_TAG: 1, |
||||
INSIDE_TAG: 2 |
||||
}; |
||||
var state = StateEnum.OUTSIDE_TAG; |
||||
var zones = [[], []]; |
||||
var currentTextBeginPos = 0; |
||||
var currentTextEndPos = null; |
||||
var currentTagBeginPos = null; |
||||
var currentTagEndPos = null; |
||||
var currentTag = null; |
||||
|
||||
function forward() { |
||||
posInFinalText = posInFinalText + 1; |
||||
posInText = posInText + 1; |
||||
} |
||||
|
||||
function seenOpeningTag() { |
||||