test_class.declarator: logger = LoggerFactory.getLogger(AssemblerTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(AssemblerTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.declarator: script
test_class.modifier: @Parameter
  	public
test_class.original_string: @Parameter
  	public String script;
test_class.type: String
test_class.var_name: script
test_class.file: cache/src/test/java/net/runelite/cache/script/assembler/AssemblerTest.java
test_class.identifier: AssemblerTest
test_case.body: @Test
  	public void testAssemble() throws Exception
  	{
  		InputStream in = AssemblerTest.class.getResourceAsStream(script);
  		Assert.assertNotNull(in);
  
  		Instructions instructions = new Instructions();
  		instructions.init();
  
  		Assembler assembler = new Assembler(instructions);
  		ScriptDefinition script = assembler.assemble(in);
  
  		// compare with disassembler
  		Disassembler disassembler = new Disassembler();
  		String out = disassembler.disassemble(script);
  
  		in = AssemblerTest.class.getResourceAsStream(this.script);
  		Assert.assertNotNull(in);
  
  		String original = new String(IOUtils.toByteArray(in), StandardCharsets.UTF_8).replaceAll("\r\n", "\n");
  
  		logger.info(original);
  		logger.info("-----------------------");
  		logger.info(out);
  
  		Assert.assertEquals(original, out);
  	}
test_case.class_method_signature: AssemblerTest.testAssemble()
test_case.full_signature: @Test public void testAssemble()
test_case.identifier: testAssemble
test_case.invocations: getResourceAsStream assertNotNull init assemble disassemble getResourceAsStream assertNotNull replaceAll toByteArray info info info assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAssemble()
focal_class.declarator: instructions
focal_class.modifier: private final
focal_class.original_string: private final Instructions instructions;
focal_class.type: Instructions
focal_class.var_name: instructions
focal_class.file: cache/src/main/java/net/runelite/cache/script/assembler/Assembler.java
focal_class.identifier: Assembler
focal_class.class_method_signature: Assembler.Assembler(Instructions instructions)
focal_class.full_signature: public  Assembler(Instructions instructions)
focal_class.identifier: Assembler
focal_class.modifiers: public
focal_class.parameters: (Instructions instructions)
focal_class.signature:  Assembler(Instructions instructions)
focal_class.class_method_signature: Assembler.assemble(InputStream in)
focal_class.full_signature: public ScriptDefinition assemble(InputStream in)
focal_class.identifier: assemble
focal_class.modifiers: public
focal_class.parameters: (InputStream in)
focal_class.return: ScriptDefinition
focal_class.signature: ScriptDefinition assemble(InputStream in)
focal_method.body: public ScriptDefinition assemble(InputStream in) throws IOException
  	{
  		// Get our lexer
  		rs2asmLexer lexer = new rs2asmLexer(new ANTLRInputStream(new InputStreamReader(in, StandardCharsets.UTF_8)));
  
  		LexerErrorListener errorListener = new LexerErrorListener();
  		lexer.addErrorListener(errorListener);
  
  		// Get a list of matched tokens
  		CommonTokenStream tokens = new CommonTokenStream(lexer);
  
  		// Pass the tokens to the parser
  		rs2asmParser parser = new rs2asmParser(tokens);
  
  		// Specify our entry point
  		ProgContext progContext = parser.prog();
  
  		if (errorListener.getErrors() > 0)
  		{
  			throw new RuntimeException("syntax error");
  		}
  
  		// Walk it and attach our listener
  		ParseTreeWalker walker = new ParseTreeWalker();
  
  		// walk through first and resolve labels
  		LabelVisitor labelVisitor = new LabelVisitor();
  		walker.walk(labelVisitor, progContext);
  
  		ScriptWriter listener = new ScriptWriter(instructions, labelVisitor);
  		walker.walk(listener, progContext);
  
  		return listener.buildScript();
  	}
focal_method.class_method_signature: Assembler.assemble(InputStream in)
focal_method.full_signature: public ScriptDefinition assemble(InputStream in)
focal_method.identifier: assemble
focal_method.invocations: addErrorListener prog getErrors walk walk buildScript
focal_method.modifiers: public
focal_method.parameters: (InputStream in)
focal_method.return: ScriptDefinition
focal_method.signature: ScriptDefinition assemble(InputStream in)