<commit_before>package com.cyberthinkers.scalajs.tools.generate
import collection.mutable._
import scala.collection.JavaConverters._
import com.cyberthinkers.tools.generate.GenScalaFacadesFromTypescriptParser._
import org.antlr.v4.runtime.tree._
import com.cyberthinkers.tools.generate._

import scala.collection.mutable

class GenScalaListener extends GenScalaFacadesFromTypescriptBaseListener {
  val parseTreeProperty = new ParseTreeProperty[String]()
  val definitions =  new ParseTreeProperty[Definition]()
  val global = mutable.ArrayStack[Definition]()

  override def enterTypescriptAmbientDeclarations(ctx: TypescriptAmbientDeclarationsContext): Unit = {
    global.push(ModuleOrNamespaceDef(""))
  }

  override def exitAmbientModuleName(ctx: AmbientModuleNameContext): Unit = {
    // need to check for string literals before this
    val name = (for(p <- ctx.identifierPath().ident.asScala) yield parseTreeProperty.get(p)).mkString(".")
    val definition: Definition = global.top.statements.getOrElseUpdate(name, ModuleOrNamespaceDef(name, Some(global.top)))
    global.push(definition)
  }

  override def exitAmbientModuleOrNamespace(ctx: AmbientModuleOrNamespaceContext): Unit = {
    global.pop()
  }

  override def exitClassName(ctx: ClassNameContext): Unit = {
    ctx.bindingIdentifier()
    val name = parseTreeProperty.get(ctx.bindingIdentifier())
    val definition: Definition = global.top.statements.getOrElseUpdate(name, ClassDef(name))
    global.push(definition)
  }

  override def exitClassDeclaration(ctx: ClassDeclarationContext): Unit = {
    // FIXME: missing class args
    global.pop()
  }<EMAIL>

  override def exitEnumName(ctx: EnumNameContext): Unit = {
    ctx.bindingIdentifier()
    val name = parseTreeProperty.get(ctx.bindingIdentifier())
    val accessibilityModifier = 0
    val definition: Definition = global.top.statements.getOrElseUpdate(name, EnumDef(name, accessibilityModifier))
    global.push(definition)
  }

  override def exitEnumDeclaration(ctx: EnumDeclarationContext): Unit = {<commit_msg>removed accessibilityModifier becasue it can't be placed on enum<commit_after>package com.cyberthinkers.scalajs.tools.generate
import collection.mutable._
import scala.collection.JavaConverters._
import com.cyberthinkers.tools.generate.GenScalaFacadesFromTypescriptParser._
import org.antlr.v4.runtime.tree._
import com.cyberthinkers.tools.generate._

import scala.collection.mutable

class GenScalaListener extends GenScalaFacadesFromTypescriptBaseListener {
  val parseTreeProperty = new ParseTreeProperty[String]()
  val definitions =  new ParseTreeProperty[Definition]()
  val global = mutable.ArrayStack[Definition]()

  override def enterTypescriptAmbientDeclarations(ctx: TypescriptAmbientDeclarationsContext): Unit = {
    global.push(ModuleOrNamespaceDef(""))
  }

  override def exitAmbientModuleName(ctx: AmbientModuleNameContext): Unit = {
    // need to check for string literals before this
    val name = (for(p <- ctx.identifierPath().ident.asScala) yield parseTreeProperty.get(p)).mkString(".")
    val definition: Definition = global.top.statements.getOrElseUpdate(name, ModuleOrNamespaceDef(name, Some(global.top)))
    global.push(definition)
  }

  override def exitAmbientModuleOrNamespace(ctx: AmbientModuleOrNamespaceContext): Unit = {
    global.pop()
  }

  override def exitClassName(ctx: ClassNameContext): Unit = {
    ctx.bindingIdentifier()
    val name = parseTreeProperty.get(ctx.bindingIdentifier())
    val definition: Definition = global.top.statements.getOrElseUpdate(name, ClassDef(name))
    global.push(definition)
  }

  override def exitClassDeclaration(ctx: ClassDeclarationContext): Unit = {
    // FIXME: missing class args
    global.pop()
  }

  override def exitEnumName(ctx: EnumNameContext): Unit = {
    ctx.bindingIdentifier()
    val name = parseTreeProperty.get(ctx.bindingIdentifier())
    val accessibilityModifier = 0
    val definition: Definition = global.top.statements.getOrElseUpdate(name, EnumDef(name))
    global.push(definition)
  }

  override def exitEnumDeclaration(ctx: EnumDeclarationContext): Unit = {
{'fraction_non_alphanumeric': 0.096, 'fraction_numerical': 0.0009696969696969697, 'mean_word_length': 5.406832298136646, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7663236', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1141, 'n_words': 240}