ifdef-loader
Advanced tools
Comparing version
{ | ||
"name": "ifdef-loader", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "ifdef-loader.js", |
"use strict"; | ||
var triple_slash = true; | ||
var useTripleSlash; | ||
function parse(source, defs, verbose, tripleSlash) { | ||
triple_slash = tripleSlash || true; | ||
if (tripleSlash === undefined) | ||
tripleSlash = true; | ||
useTripleSlash = tripleSlash; | ||
var lines = source.split('\n'); | ||
@@ -34,3 +36,3 @@ for (var n = 0;;) { | ||
function match_if(line) { | ||
var re = triple_slash ? /^[\s]*\/\/\/([\s]*)#(if)([\s\S]+)$/g : /^[\s]*\/\/([\s]*)#(if)([\s\S]+)$/g; | ||
var re = useTripleSlash ? /^[\s]*\/\/\/([\s]*)#(if)([\s\S]+)$/g : /^[\s]*\/\/([\s]*)#(if)([\s\S]+)$/g; | ||
var match = re.exec(line); | ||
@@ -47,3 +49,3 @@ if (match) { | ||
function match_endif(line) { | ||
var re = triple_slash ? /^[\s]*\/\/\/([\s]*)#(endif)[\s]*$/g : /^[\s]*\/\/([\s]*)#(endif)[\s]*$/g; | ||
var re = useTripleSlash ? /^[\s]*\/\/\/([\s]*)#(endif)[\s]*$/g : /^[\s]*\/\/([\s]*)#(endif)[\s]*$/g; | ||
var match = re.exec(line); | ||
@@ -50,0 +52,0 @@ if (match) |
@@ -7,6 +7,7 @@ interface IStart { | ||
let triple_slash = true; | ||
let useTripleSlash: boolean|undefined; | ||
export function parse(source, defs, verbose?: boolean, tripleSlash?: boolean): string { | ||
triple_slash = tripleSlash || true; | ||
if(tripleSlash === undefined) tripleSlash = true; | ||
useTripleSlash = tripleSlash; | ||
@@ -47,3 +48,3 @@ const lines = source.split('\n'); | ||
function match_if(line: string): IStart|undefined { | ||
const re = triple_slash ? /^[\s]*\/\/\/([\s]*)#(if)([\s\S]+)$/g : /^[\s]*\/\/([\s]*)#(if)([\s\S]+)$/g; | ||
const re = useTripleSlash ? /^[\s]*\/\/\/([\s]*)#(if)([\s\S]+)$/g : /^[\s]*\/\/([\s]*)#(if)([\s\S]+)$/g; | ||
const match = re.exec(line); | ||
@@ -61,3 +62,3 @@ if(match) { | ||
function match_endif(line: string): boolean { | ||
const re = triple_slash ? /^[\s]*\/\/\/([\s]*)#(endif)[\s]*$/g : /^[\s]*\/\/([\s]*)#(endif)[\s]*$/g; | ||
const re = useTripleSlash ? /^[\s]*\/\/\/([\s]*)#(endif)[\s]*$/g : /^[\s]*\/\/([\s]*)#(endif)[\s]*$/g; | ||
const match = re.exec(line); | ||
@@ -64,0 +65,0 @@ if(match) return true; |
18079
0.69%514
0.59%