@@ -494,6 +494,7 @@ impl Getter for CppCode {
494494
495495impl Getter for PreprocCode { }
496496impl Getter for CcommentCode { }
497+
497498impl Getter for JavaCode {
498499 fn get_space_kind ( node : & Node ) -> SpaceKind {
499500 use Java :: * ;
@@ -514,26 +515,27 @@ impl Getter for JavaCode {
514515 // https://www.geeksforgeeks.org/software-engineering-halsteads-software-metrics/?msclkid=5e181114abef11ecbb03527e95a34828
515516 match node. kind_id ( ) . into ( ) {
516517 // Operator: function calls
517- MethodInvocation
518+ // MethodInvocation
518519 // Operator: control flow
519520 | If | Else | Switch | Case | Try | Catch | Throw | Throws | Throws2 | For | While | Continue | Break | Do | Finally
520521 // Operator: keywords
521522 | New | Return | Default | Abstract | Assert | Instanceof | Extends | Final | Implements | Transient | Synchronized | Super | This | VoidType
522523 // Operator: brackets and comma and terminators (separators)
523- | SEMI | COMMA | COLONCOLON | LBRACE | LBRACK | LPAREN | RBRACE | RBRACK | RPAREN | DOTDOTDOT | DOT
524+ | SEMI | COMMA | COLONCOLON | LBRACE | LBRACK | LPAREN // | RBRACE | RBRACK | RPAREN | DOTDOTDOT | DOT
524525 // Operator: operators
525526 | EQ | LT | GT | BANG | TILDE | QMARK | COLON // no grammar for lambda operator ->
526527 | EQEQ | LTEQ | GTEQ | BANGEQ | AMPAMP | PIPEPIPE | PLUSPLUS | DASHDASH
527528 | PLUS | DASH | STAR | SLASH | AMP | PIPE | CARET | PERCENT | LTLT | GTGT | GTGTGT
528529 | PLUSEQ | DASHEQ | STAREQ | SLASHEQ | AMPEQ | PIPEEQ | CARETEQ | PERCENTEQ | LTLTEQ | GTGTEQ | GTGTGTEQ
529530 // type identifier
530- | TypeIdentifier | IntegralType | FloatingPointType | BooleanType
531+ //| TypeIdentifier | BooleanType| IntegralType | FloatingPointType
532+ // primitive types
533+ | Int | Float
531534 => {
532535 HalsteadType :: Operator
533536 } ,
534537 // Operands: variables, constants, literals
535- Identifier | NullLiteral | ClassLiteral | StringLiteral | CharacterLiteral | HexIntegerLiteral | OctalIntegerLiteral
536- | BinaryIntegerLiteral | DecimalIntegerLiteral | HexFloatingPointLiteral | DecimalFloatingPointLiteral => {
538+ Identifier | NullLiteral | ClassLiteral | StringLiteral | CharacterLiteral | HexIntegerLiteral | OctalIntegerLiteral | BinaryIntegerLiteral | DecimalIntegerLiteral | HexFloatingPointLiteral | DecimalFloatingPointLiteral => {
537539 HalsteadType :: Operand
538540 } ,
539541 _ => {
@@ -542,7 +544,17 @@ impl Getter for JavaCode {
542544 }
543545 }
544546
545- get_operator ! ( Java ) ;
547+ fn get_operator_id_as_str ( id : u16 ) -> & ' static str {
548+ let typ = id. into ( ) ;
549+ match typ {
550+ Java :: LPAREN => "()" ,
551+ Java :: LBRACK => "[]" ,
552+ Java :: LBRACE => "{}" ,
553+ Java :: VoidType => "void" ,
554+ _ => typ. into ( ) ,
555+ }
556+ }
557+ //get_operator!(Java);
546558}
547559
548560impl Getter for KotlinCode { }
0 commit comments