prebirth: Ignore comments in JS parser
* build-aux/bootstrap/prebirth.js (parseLisp): Ingore comment tokens. (_lex): Recognize comments.master
parent
3c5089417c
commit
6a736a8fcd
|
@ -97,6 +97,10 @@ class Parser
|
||||||
// a very simple bootstrap lisp)
|
// a very simple bootstrap lisp)
|
||||||
switch ( type )
|
switch ( type )
|
||||||
{
|
{
|
||||||
|
// ignore comments
|
||||||
|
case 'comment':
|
||||||
|
return result;
|
||||||
|
|
||||||
// closing parenthesis (end of sexp)
|
// closing parenthesis (end of sexp)
|
||||||
case 'close':
|
case 'close':
|
||||||
if ( depth === 0 ) {
|
if ( depth === 0 ) {
|
||||||
|
@ -197,6 +201,12 @@ class Parser
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// comment until end of line
|
||||||
|
if ( trim[ 0 ] === ';' ) {
|
||||||
|
const eol = trim.match( /^(.*?)(\n|$)/ );
|
||||||
|
return this._token( 'comment', eol[ 1 ], trim, pos );
|
||||||
|
}
|
||||||
|
|
||||||
// left and right parenthesis are handled in the same manner: they
|
// left and right parenthesis are handled in the same manner: they
|
||||||
// produce distinct tokens with single-character lexemes
|
// produce distinct tokens with single-character lexemes
|
||||||
if ( trim[ 0 ] === '(' ) {
|
if ( trim[ 0 ] === '(' ) {
|
||||||
|
|
Loading…
Reference in New Issue