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)
|
||||
switch ( type )
|
||||
{
|
||||
// ignore comments
|
||||
case 'comment':
|
||||
return result;
|
||||
|
||||
// closing parenthesis (end of sexp)
|
||||
case 'close':
|
||||
if ( depth === 0 ) {
|
||||
|
@ -197,6 +201,12 @@ class Parser
|
|||
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
|
||||
// produce distinct tokens with single-character lexemes
|
||||
if ( trim[ 0 ] === '(' ) {
|
||||
|
|
Loading…
Reference in New Issue