@@ -50,7 +50,7 @@ export default class Parser {
5050 * @returns A boolean indicating if there are more tokens.
5151 */
5252 private not_eof ( ) : boolean {
53- return this . tokens [ 0 ] . type != TokenType . EOF ;
53+ return this . tokens [ 0 ] . type !== TokenType . EOF ;
5454 }
5555
5656 /**
@@ -79,7 +79,7 @@ export default class Parser {
7979 */
8080 private expect ( type : TokenType , err : string ) {
8181 const prev = this . tokens . shift ( ) as Token ;
82- if ( ! prev || prev . type != type ) {
82+ if ( ! prev || prev . type !== type ) {
8383 console . error ( "Parser Error: \n" , err , prev , "- Expecting: " , type ) ;
8484 Deno . exit ( 1 ) ;
8585 }
@@ -497,13 +497,13 @@ export default class Parser {
497497 * @throws {Error } If there are syntax errors or missing tokens in the statement.
498498 */
499499 private parse_var_declaration ( ) : Stmt {
500- const isConstant = this . eat ( ) . type == TokenType . NewEternal ;
500+ const isConstant = this . eat ( ) . type === TokenType . NewEternal ;
501501 const identifier = this . expect (
502502 TokenType . Identifier ,
503503 "Expected identifier name while declaration" ,
504504 ) . value ;
505505
506- if ( this . at ( ) . type == TokenType . Semicolon ) {
506+ if ( this . at ( ) . type === TokenType . Semicolon ) {
507507 // Consume semicolon
508508 this . eat ( ) ;
509509 if ( isConstant ) {
@@ -557,7 +557,7 @@ export default class Parser {
557557 */
558558 private parse_assignment_expr ( ) : Expr {
559559 const left = this . parse_logical_expr ( ) ;
560- if ( this . at ( ) . type == TokenType . Equals ) {
560+ if ( this . at ( ) . type === TokenType . Equals ) {
561561 // Consume the equals token we just found
562562 this . eat ( ) ;
563563
@@ -588,7 +588,7 @@ export default class Parser {
588588 private parse_logical_expr ( ) : Expr {
589589 let left = this . parse_comparison_expr ( ) ;
590590
591- while ( this . at ( ) . type == TokenType . LogicalOperator ) {
591+ while ( this . at ( ) . type === TokenType . LogicalOperator ) {
592592 const operator = this . eat ( ) . value ;
593593 const right = this . parse_comparison_expr ( ) ;
594594
@@ -611,7 +611,7 @@ export default class Parser {
611611 let left = this . parse_additive_expr ( ) ;
612612
613613 while (
614- this . at ( ) . type == TokenType . ComparisonOperator
614+ this . at ( ) . type === TokenType . ComparisonOperator
615615 ) {
616616 const operator = this . eat ( ) . value ; // Consume the comparison operator token
617617 const right = this . parse_additive_expr ( ) ; // Parse the right-hand side of the comparison
@@ -638,7 +638,7 @@ export default class Parser {
638638 let left = this . parse_multiplicative_expr ( ) ;
639639
640640 // Pase operator
641- while ( this . at ( ) . value == "+" || this . at ( ) . value == "-" ) {
641+ while ( this . at ( ) . value === "+" || this . at ( ) . value = == "-" ) {
642642 const operator = this . eat ( ) . value ;
643643 const right = this . parse_multiplicative_expr ( ) ;
644644
@@ -661,7 +661,8 @@ export default class Parser {
661661
662662 // Pase operator
663663 while (
664- this . at ( ) . value == "*" || this . at ( ) . value == "/" || this . at ( ) . value == "%"
664+ this . at ( ) . value === "*" || this . at ( ) . value === "/" ||
665+ this . at ( ) . value === "%"
665666 ) {
666667 const operator = this . eat ( ) . value ;
667668 const right = this . parse_exponential_expr ( ) ;
@@ -685,7 +686,7 @@ export default class Parser {
685686
686687 // Pase operator
687688 while (
688- this . at ( ) . value == "^"
689+ this . at ( ) . value === "^"
689690 ) {
690691 const operator = this . eat ( ) . value ;
691692 const right = this . parse_call_member_expr ( ) ;
@@ -709,7 +710,7 @@ export default class Parser {
709710 private parse_call_member_expr ( ) : Expr {
710711 const member = this . parse_member_expr ( ) ;
711712
712- if ( this . at ( ) . type == TokenType . OpenParen ) {
713+ if ( this . at ( ) . type === TokenType . OpenParen ) {
713714 return this . parse_call_expr ( member ) ;
714715 }
715716 return member ;
@@ -729,7 +730,7 @@ export default class Parser {
729730 args : this . parse_args ( ) ,
730731 } as CallExpr ;
731732
732- if ( this . at ( ) . type == TokenType . OpenParen ) {
733+ if ( this . at ( ) . type === TokenType . OpenParen ) {
733734 call_expr = this . parse_call_expr ( call_expr ) ;
734735 }
735736
@@ -744,7 +745,7 @@ export default class Parser {
744745 */
745746 private parse_args ( ) : Expr [ ] {
746747 this . expect ( TokenType . OpenParen , `Expected open parenthesis` ) ;
747- const args = this . at ( ) . type == TokenType . CloseParen
748+ const args = this . at ( ) . type === TokenType . CloseParen
748749 ? [ ]
749750 : this . parse_arguments_list ( ) ;
750751
@@ -761,7 +762,7 @@ export default class Parser {
761762 private parse_arguments_list ( ) : Expr [ ] {
762763 const args = [ this . parse_assignment_expr ( ) ] ;
763764
764- while ( this . at ( ) . type == TokenType . Comma && this . eat ( ) ) {
765+ while ( this . at ( ) . type === TokenType . Comma && this . eat ( ) ) {
765766 args . push ( this . parse_assignment_expr ( ) ) ;
766767 }
767768
0 commit comments