$ANTLR start "EXTENSIONS"
326129
public final void mEXTENSIONS() throws RecognitionException {
        try {
            int _type = EXTENSIONS;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // com/dyuproject/protostuff/parser/ProtoLexer.g:135:5: ( 'extensions' )
            // com/dyuproject/protostuff/parser/ProtoLexer.g:135:9: 'extensions'
            {
            match("extensions"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
7609
public final void mCOMMENT() throws RecognitionException {
        try {
            int _type = COMMENT;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // /home/victor/srec/core/src/main/antlr/srec.g:155:2: ( '#' ( . )* NEWLINE )
            // /home/victor/srec/core/src/main/antlr/srec.g:155:4: '#' ( . )* NEWLINE
            {
            match('#'); 
            // /home/victor/srec/core/src/main/antlr/srec.g:155:8: ( . )*
            loop11:
            do {
                int alt11=2;
                int LA11_0 = input.LA(1);

                if ( (LA11_0=='\r') ) {
                    alt11=2;
                }
                else if ( (LA11_0=='\n') ) {
                    alt11=2;
                }
                else if ( ((LA11_0>='\u0000' && LA11_0<='\t')||(LA11_0>='\u000B' && LA11_0<='\f')||(LA11_0>='\u000E' && LA11_0<='\uFFFF')) ) {
                    alt11=1;
                }


                switch (alt11) {
            	case 1 :
            	    // /home/victor/srec/core/src/main/antlr/srec.g:155:8: .
            	    {
            	    matchAny(); 

            	    }
            	    break;

            	default :
            	    break loop11;
                }
            } while (true);

            skip();
            mNEWLINE(); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
5637
private void parseExtension(Extension ext) throws IOException {
        try {
            Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
            if (extClass == null) {   // Unsupported extension
                if (ext.isCritical()) {
                    unsupportedCritExt = true;
                }
                if (map.put(ext.getExtensionId().toString(), ext) == null) {
                    return;
                } else {
                    throw new IOException("Duplicate extensions not allowed");
                }
            }
            Constructor<?> cons = extClass.getConstructor(PARAMS);

            Object[] passed = new Object[] {Boolean.valueOf(ext.isCritical()),
                    ext.getExtensionValue()};
                    CertAttrSet<?> certExt = (CertAttrSet<?>)
                            cons.newInstance(passed);
                    if (map.put(certExt.getName(), (Extension)certExt) != null) {
                        throw new IOException("Duplicate extensions not allowed");
                    }
        } catch (InvocationTargetException invk) {
            Throwable e = invk.getTargetException();
            if (ext.isCritical() == false) {
                // ignore errors parsing non-critical extensions
                if (unparseableExtensions == null) {
                    unparseableExtensions = new TreeMap<String,Extension>();
                }
                unparseableExtensions.put(ext.getExtensionId().toString(),
                        new UnparseableExtension(ext, e));
                if (debug != null) {
                    debug.println("Error parsing extension: " + ext);
                    e.printStackTrace();
                    HexDumpEncoder h = new HexDumpEncoder();
                    System.err.println(h.encodeBuffer(ext.getExtensionValue()));
                }
                return;
            }
            if (e instanceof IOException) {
                throw (IOException)e;
            } else {
                throw new IOException(e);
            }
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw new IOException(e);
        }
    }
1188404
public static void registerExtension (String extension, Class<? extends StreamDecoder> clazz)
    {
        _extensions.put(extension, clazz);
    }
144904
private void extractAndWriteExtensionsAsDirectChild(IBase theElement, JsonLikeWriter theEventWriter, BaseRuntimeElementDefinition<?> theElementDef, RuntimeResourceDefinition theResDef,
																		 IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent, EncodeContext theEncodeContext) throws IOException {
		List<HeldExtension> extensions = new ArrayList<>(0);
		List<HeldExtension> modifierExtensions = new ArrayList<>(0);

		// Undeclared extensions
		extractUndeclaredExtensions(theElement, extensions, modifierExtensions, theChildElem, theParent);

		// Declared extensions
		if (theElementDef != null) {
			extractDeclaredExtensions(theElement, theElementDef, extensions, modifierExtensions, theChildElem);
		}

		// Write the extensions
		writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions, theEncodeContext);
	}
845268
function config (args) {
    // make sure extension has .
    if (args && typeof args.ext === 'string' && args.ext.charAt(0) !== '.') {
        args.ext = '.'+args.ext
    }
    // merge config to global config
    mergeArgs(GLOBAL, args)
    // create regular expression for matching extension
    GLOBAL.extRegExp = new RegExp('\\'+GLOBAL.ext+'$')
    // return config
    return GLOBAL
}
908478
def load_extensions(environment, extensions):
    
    result = {}
    for extension in extensions:
        if isinstance(extension, basestring):
            extension = import_string(extension)
        result[extension.identifier] = extension(environment)
    return result
669487
function checkExtend1(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  if (l = checkExtendSelector(i)) i += l;
  else return 0;

  if (tokens[i + 1] &&
      tokens[i + 1].value === 'extend' &&
      (l = checkPseudoc(i))) i += l;
  else return 0;

  if (l = checkSC(i)) i += l;

  if (l = checkBlock(i)) i += l;
  else return 0;

  return i - start;
}
116942
public final void mNEWLINE() throws RecognitionException {
        try {
            int _type = NEWLINE;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // /home/victor/srec/core/src/main/antlr/srec.g:151:2: ( ( ( '\\r' )? '\\n' ( ' ' )* )+ )
            // /home/victor/srec/core/src/main/antlr/srec.g:151:4: ( ( '\\r' )? '\\n' ( ' ' )* )+
            {
            // /home/victor/srec/core/src/main/antlr/srec.g:151:4: ( ( '\\r' )? '\\n' ( ' ' )* )+
            int cnt10=0;
            loop10:
            do {
                int alt10=2;
                int LA10_0 = input.LA(1);

                if ( (LA10_0=='\n'||LA10_0=='\r') ) {
                    alt10=1;
                }


                switch (alt10) {
            	case 1 :
            	    // /home/victor/srec/core/src/main/antlr/srec.g:151:5: ( '\\r' )? '\\n' ( ' ' )*
            	    {
            	    // /home/victor/srec/core/src/main/antlr/srec.g:151:5: ( '\\r' )?
            	    int alt8=2;
            	    int LA8_0 = input.LA(1);

            	    if ( (LA8_0=='\r') ) {
            	        alt8=1;
            	    }
            	    switch (alt8) {
            	        case 1 :
            	            // /home/victor/srec/core/src/main/antlr/srec.g:151:5: '\\r'
            	            {
            	            match('\r'); 

            	            }
            	            break;

            	    }

            	    match('\n'); 
            	    // /home/victor/srec/core/src/main/antlr/srec.g:151:16: ( ' ' )*
            	    loop9:
            	    do {
            	        int alt9=2;
            	        int LA9_0 = input.LA(1);

            	        if ( (LA9_0==' ') ) {
            	            alt9=1;
            	        }


            	        switch (alt9) {
            	    	case 1 :
            	    	    // /home/victor/srec/core/src/main/antlr/srec.g:151:16: ' '
            	    	    {
            	    	    match(' '); 

            	    	    }
            	    	    break;

            	    	default :
            	    	    break loop9;
            	        }
            	    } while (true);


            	    }
            	    break;

            	default :
            	    if ( cnt10 >= 1 ) break loop10;
                        EarlyExitException eee =
                            new EarlyExitException(10, input);
                        throw eee;
                }
                cnt10++;
            } while (true);


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
440905
public void beginType(String type, String kind, int modifiers,
      String extendsType, String... implementsTypes) throws IOException {
    indent();
    modifiers(modifiers);
    out.write(kind);
    out.write(" ");
    type(type);
    if (extendsType != null) {
      out.write("\n");
      indent();
      out.write("    extends ");
      type(extendsType);
    }
    if (implementsTypes.length > 0) {
      out.write("\n");
      indent();
      out.write("    implements ");
      for (int i = 0; i < implementsTypes.length; i++) {
        if (i != 0) {
          out.write(", ");
        }
        type(implementsTypes[i]);
      }
    }
    out.write(" {\n");
    pushScope(Scope.TYPE_DECLARATION);
  }
441919
def extension
      @extension ||= begin
        list = @xml.find('/e:epp/e:response/e:extension/node()').reject { |n| n.empty? }
        list.size > 1 ? list : list[0]
      end
    end
199999
public final void mExponent() throws RecognitionException {
		try {
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1338:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1338:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+
			{
			if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
				input.consume();
			}
			else {
				MismatchedSetException mse = new MismatchedSetException(null,input);
				recover(mse);
				throw mse;
			}
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1338:22: ( '+' | '-' )?
			int alt20=2;
			int LA20_0 = input.LA(1);
			if ( (LA20_0=='+'||LA20_0=='-') ) {
				alt20=1;
			}
			switch (alt20) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
					{
					if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
						input.consume();
					}
					else {
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

			}

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1338:33: ( '0' .. '9' )+
			int cnt21=0;
			loop21:
			while (true) {
				int alt21=2;
				int LA21_0 = input.LA(1);
				if ( ((LA21_0 >= '0' && LA21_0 <= '9')) ) {
					alt21=1;
				}

				switch (alt21) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
					{
					if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
						input.consume();
					}
					else {
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

				default :
					if ( cnt21 >= 1 ) break loop21;
					EarlyExitException eee = new EarlyExitException(21, input);
					throw eee;
				}
				cnt21++;
			}

			}

		}
		finally {
			// do for sure before leaving
		}
	}
1002044
private void nextFromPrologBang(boolean isProlog)
        throws XMLStreamException
    {
        int i = getNext();
        if (i < 0) {
            throwUnexpectedEOF(SUFFIX_IN_PROLOG);
        }
        if (i == 'D') { // Doctype declaration?
            String keyw = checkKeyword('D', "DOCTYPE");
            if (keyw != null) {
                throwParseError("Unrecognized XML directive '<!"+keyw+"' (misspelled DOCTYPE?).");
            }
            
            if (!isProlog) {
                // Still possibly ok in multidoc mode...
                if (mConfig.inputParsingModeDocuments()) {
                    if (!mStDoctypeFound) {
                        mCurrToken = handleMultiDocStart(DTD);
                        return;
                    }
                } else {
                    throwParseError(ErrorConsts.ERR_DTD_IN_EPILOG);
                }
            }
            if (mStDoctypeFound) {
                throwParseError(ErrorConsts.ERR_DTD_DUP);
            }
            mStDoctypeFound = true;
            // Ok; let's read main input (all but internal subset)
            mCurrToken = DTD;
            startDTD();
            return;
        } else if (i == '-') { // comment
            char c = getNextChar(isProlog ? SUFFIX_IN_PROLOG : SUFFIX_IN_EPILOG);
            if (c != '-') {
                throwUnexpectedChar(i, " (malformed comment?)");
            }
            // Likewise, let's delay actual parsing/skipping.
            mTokenState = TOKEN_STARTED;
            mCurrToken = COMMENT;
            return;
        } else if (i == '[') { // erroneous CDATA?
            i = peekNext();
            // Let's just add bit of heuristics, to get better error msg
            if (i == 'C') {
                throwUnexpectedChar(i, ErrorConsts.ERR_CDATA_IN_EPILOG);
            }
        }

        throwUnexpectedChar(i, " after '<!' (malformed comment?)");
    }
917274
def get_extensions(extstr):
    """"""
    # Extension examples:
    #   has_direct_input(UniProtKB:P37840),occurs_in(GO:0005576)
    #   part_of(UBERON:0006618),part_of(UBERON:0002302)
    #   occurs_in(CL:0000988)|occurs_in(CL:0001021)
    if not extstr:
        return None
    exts = []
    for ext_lst in extstr.split('|'):
        grp = []
        for ext in ext_lst.split(','):
            idx = ext.find('(')
            if idx != -1 and ext[-1] == ')':
                grp.append(AnnotationExtension(ext[:idx], ext[idx+1:-1]))
            else:
                # Ignore improperly formatted Extensions
                sys.stdout.write('BAD Extension({E})\n'.format(E=ext))
        exts.append(grp)
    return AnnotationExtensions(exts)
1273300
private Map<String, Object> mkExtensions(Throwable exception) {
        Map<String, Object> extensions = null;
        if (exception instanceof GraphQLError) {
            Map<String, Object> map = ((GraphQLError) exception).getExtensions();
            if (map != null) {
                extensions = new LinkedHashMap<>();
                extensions.putAll(map);
            }
        }
        return extensions;
    }
145413
def parse_input_object_type_extension(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    expect_keyword(lexer, "extend")
    expect_keyword(lexer, "input")
    name = parse_name(lexer)
    directives = parse_directives(lexer, True)
    fields = parse_input_fields_definition(lexer)
    if not (directives or fields):
        raise unexpected(lexer)
    return Node(
        name=name, directives=directives, fields=fields, loc=loc(lexer, start)
    )
599222
function appendExpression(prefix, token, suffix, isString) {
		if (state === 'very-first') {
			if (!isString) {
				builder.add('""+')
			}
		} else if (state === 'first') {
			builder.add('__o+=')
		} else {
			builder.add('+')
		}

		if (options.compileDebug && token) {
			builder.add(`(${getDebugMarker(token)},`)
		}
		if (prefix) {
			builder.add(prefix)
		}
		if (token) {
			if (token.type === 'source-builder') {
				builder.addBuilder(token.sourceBuilder)
			} else {
				builder.addToken(token)
			}
		}
		if (suffix) {
			builder.add(suffix)
		}
		if (options.compileDebug && token) {
			builder.add(')')
		}

		state = 'rest'
	}