New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

coffee-lex

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffee-lex - npm Package Compare versions

Comparing version 9.0.0 to 9.1.0

8

dist/index.d.ts
import SourceLocation from './SourceLocation';
import SourceTokenList from './SourceTokenList';
import SourceType from './SourceType';
export declare type Options = {
useCS2: boolean;
};
export declare const DEFAULT_OPTIONS: Options;
/**
* Generate a list of tokens from CoffeeScript source code.
*/
export default function lex(source: string): SourceTokenList;
export default function lex(source: string, options?: Options): SourceTokenList;
export { SourceType };

@@ -12,3 +16,3 @@ /**

*/
export declare function stream(source: string, index?: number): () => SourceLocation;
export declare function stream(source: string, index?: number, options?: Options): () => SourceLocation;
export declare function consumeStream(lexer: () => SourceLocation): Array<SourceLocation>;

@@ -22,10 +22,14 @@ "use strict";

})(ContextType || (ContextType = {}));
exports.DEFAULT_OPTIONS = {
useCS2: false
};
/**
* Generate a list of tokens from CoffeeScript source code.
*/
function lex(source) {
function lex(source, options) {
if (options === void 0) { options = exports.DEFAULT_OPTIONS; }
var location;
var previousLocation;
var tokens = [];
var pending = new BufferedStream_1.default(stream(source));
var pending = new BufferedStream_1.default(stream(source, 0, options));
do {

@@ -191,4 +195,5 @@ pending.unshift.apply(pending, calculateNormalStringPadding_1.default(source, pending));

*/
function stream(source, index) {
function stream(source, index, options) {
if (index === void 0) { index = 0; }
if (options === void 0) { options = exports.DEFAULT_OPTIONS; }
var location = new SourceLocation_1.default(SourceType_1.default.NORMAL, index);

@@ -298,2 +303,3 @@ var contextStack = [];

type: ContextType.STRING,
allowComments: false,
allowInterpolations: true,

@@ -308,2 +314,3 @@ endingDelimiter: '"""',

type: ContextType.STRING,
allowComments: false,
allowInterpolations: true,

@@ -318,2 +325,3 @@ endingDelimiter: '"',

type: ContextType.STRING,
allowComments: false,
allowInterpolations: false,

@@ -328,2 +336,3 @@ endingDelimiter: "'''",

type: ContextType.STRING,
allowComments: false,
allowInterpolations: false,

@@ -344,2 +353,3 @@ endingDelimiter: "'",

type: ContextType.STRING,
allowComments: true,
allowInterpolations: true,

@@ -609,3 +619,3 @@ endingDelimiter: '///',

}
var allowInterpolations = context_2.allowInterpolations, endingDelimiter = context_2.endingDelimiter, endSourceType = context_2.endSourceType;
var allowComments = context_2.allowComments, allowInterpolations = context_2.allowInterpolations, endingDelimiter = context_2.endingDelimiter, endSourceType = context_2.endSourceType;
if (consume('\\')) {

@@ -621,2 +631,5 @@ index++;

}
else if (options.useCS2 && allowComments && match('#') && !match('#{')) {
setType(SourceType_1.default.HEREGEXP_COMMENT);
}
else {

@@ -643,2 +656,10 @@ index++;

break;
case SourceType_1.default.HEREGEXP_COMMENT:
if (consume('\n')) {
setType(SourceType_1.default.STRING_CONTENT);
}
else {
index++;
}
break;
case SourceType_1.default.INTERPOLATION_END: {

@@ -645,0 +666,0 @@ var context_3 = contextStack.pop();

@@ -40,2 +40,3 @@ /**

HEREJS = "HEREJS",
HEREGEXP_COMMENT = "HEREGEXP_COMMENT",
HEREGEXP_START = "HEREGEXP_START",

@@ -42,0 +43,0 @@ HEREGEXP_END = "HEREGEXP_END",

@@ -43,2 +43,3 @@ "use strict";

SourceType["HEREJS"] = "HEREJS";
SourceType["HEREGEXP_COMMENT"] = "HEREGEXP_COMMENT";
SourceType["HEREGEXP_START"] = "HEREGEXP_START";

@@ -45,0 +46,0 @@ SourceType["HEREGEXP_END"] = "HEREGEXP_END";

@@ -50,3 +50,3 @@ {

},
"version": "9.0.0"
"version": "9.1.0"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc