// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
[Serializable]
public class List : List<object>, IList
{
public static string operator%(string format, List rhs)
public List()
public List(IEnumerable enumerable) : base(enumerable)
protected override List<object> NewConcreteList(object[] items, bool takeOwnership)
{
*
* $Id: //depot/code/org.antlr/release/antlr-2.7.5/antlr/collections/impl/LList.java#1 $
import antlr.collections.List;
/**A Linked List Implementation (not thread-safe for simplicity)
*/
public class LList implements List, Stack {
/** Add an object to the end of the list.
/** Append an object to the end of the list.
/**Delete the object at the head of the list.
* @return the object found at the head of the list.
def __init__(self):
self.buffer = [] # empty list
## probably better to return a list of items
## probably better to return a list of items
if string:
self.text = list(string)
## codecs - but I'm rather unsure about this. Anyway, if this is
## the case, I'm going to split this string into a list of chars
return
if not isinstance(data,list):
raise TypeError("BitSet requires integer, long, or " +
"list argument")
if not isinstance(x,long):
raise TypeError(self,"List argument item is " +
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
{
List types = CollectTypes();
void CollectTypes(List types, TypeMemberCollection members)
{
ListLiteralExpression items = node.Arguments[1] as ListLiteralExpression;
override public void OnListLiteralExpression(ListLiteralExpression node)
_il.Emit(OpCodes.Ldc_I4_1);
_il.Emit(OpCodes.Newobj, List_ArrayBoolConstructor);
{
_il.Emit(OpCodes.Newobj, List_EmptyConstructor);
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
[Serializable]
public class List<T> : IList<T>, IList
public List() : this(DefaultCapacity)
public List(System.Collections.IEnumerable enumerable) : this()
public List(int initialCapacity)
public List(T[] items, bool takeOwnership)
public static List<T> operator*(List<T> lhs, int count)
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
{
IList list = (IList)target;
return list[NormalizeIndex(list.Count, (int)args[0])];
}
{
IList list = (IList)target;
list[NormalizeIndex(list.Count, (int)args[0])] = args[1];
return args[1];
if (null == enumerator) Error("CantUnpackNull");
if (!enumerator.MoveNext()) Error("UnpackListOfWrongSize");
public static bool op_NotMember(object lhs, IList rhs)
<p>
<b>Rule references.</b> Rule references become method calls. Arguments to rules become arguments to the invoked methods. Return values are assigned like Java assignments. Consider rule reference <tt>i=list[1]</tt> to rule: <tt>
<p>
Hidden tokens are weaved amongst the normal tokens. Note that, for garbage collection reasons, hidden tokens never point back to normal tokens (preventing a linked list of the entire token stream).
<tt><pre>
stat: (list EQUAL) => list EQUAL list
| list
;
list: LPAREN (ID)* RPAREN
// test prediction of alt 1
list();
match(EQUAL);
list();
else if ( LA(1)==LPAREN ) {
list();
using Assembly = System.Reflection.Assembly;
using ArrayList = System.Collections.ArrayList;
//
// With many thanks to Eric V. Smith from the ANTLR list.
// factory.
if (tokenType > (heteroList_.Length+1))
// And add new thing..
if (heteroList_[tokenType] == null)
heteroList_[tokenType] = new FactoryEntry(loadNodeTypeObject(NodeTypeName));
else
heteroList_[tokenType].NodeTypeObject = loadNodeTypeObject(NodeTypeName);
// factory.
if (NodeType > (heteroList_.Length+1))
// And add new thing..
if (heteroList_[NodeType] == null)
heteroList_[NodeType] = new FactoryEntry(creator);
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
public ExternalType IListType;
Cache(BuiltinsType = new ExternalType(this, Types.Builtins));
Cache(ListType = new ExternalType(this, Types.List));
Cache(ICollectionType = new ExternalType(this, Types.ICollection));
Cache(IListType = new ExternalType(this, Types.IList));
public static bool ContainsMethodsOnly(List members)
{
List members = new List();
override public bool Resolve(List targetList, string name, EntityType flags)
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
_ICollection_get_Count = null;
_List_GetRange1 = null;
_List_GetRange2 = null;
_ICallable_Call = null;
{
List getMethods = new List();
private static IEntity[] ToEntityArray(List entities)
{
if (TypeSystemServices.ListType.IsAssignableFrom(targetType))
{
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
{
return new List(enumerable).ToArray();
// and get the fast path whenever possible
List l = null;
{
l = new List();
{
l = new List(enumerable);
{
return new List(iterator(enumerable)).Reversed;
public static IEnumerable<object> cat(params object[] args)
using Assembly = System.Reflection.Assembly;
using ArrayList = System.Collections.ArrayList;
//
// With many thanks to Eric V. Smith from the ANTLR list.
// factory.
if (tokenType > (heteroList_.Length+1))
// And add new thing..
if (heteroList_[tokenType] == null)
heteroList_[tokenType] = new FactoryEntry(loadNodeTypeObject(NodeTypeName));
else
heteroList_[tokenType].NodeTypeObject = loadNodeTypeObject(NodeTypeName);
// factory.
if (NodeType > (heteroList_.Length+1))
// And add new thing..
if (heteroList_[NodeType] == null)
heteroList_[NodeType] = new FactoryEntry(creator);
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
--bootclasspath=ARG use this option to set bootclasspath when using
jikes. ARG is a white space seperated list of
that JAVACFLAGS understands the following: "+ flag1 flag2 .."
append "flag1 flag2 .." to precomputed list "- flag1 flag2 .."
prepend "flag1 flag2 .." to precomputed list "= flag1 flag2 ..
CSHARPC By default we search for "cscc", "msc" and "csc" in $PATH to
compile C# files. Override this by providing a list of
## Search for well known make programs - take user given MAKE
## into account. The result will be a list of valid make prog-
#Search all the common names for GNU make
ax_gnu_make_list="${MAKE}"
MAKE=
for a in . ${ax_gnu_make_list} ; do
ax_arg_list="java gij"
<pre><tt>class MyParser extends Parser;
idList : ( ID )+; // parser rule definition
<p>
which means "match a node of type A, and then descend into its list of children and match B and C". This notation can be nested arbitrarily, using #(...) anywhere an EBNF construct could be used, for example:
{ Vector ids=null; } // init-action
: "(" ids=idList ")"
;
idList returns [Vector strs]
<p>
The vocabulary space is very important for this operator. In parsers, the complete list of token types is known to ANTLR and, hence, ANTLR simply clones that set and clears the indicated element. For characters, you must specify the character vocabulary if you want to use the complement operator. Note that for large vocabularies like Unicode character blocks, complementing a character means creating a set with 2^16 elements in the worst case (about 8k). The character vocabulary is the union of characters specified in the <tt>charVocabulary</tt> option and any characters referenced in the lexer rules. Here is a sample use of the character vocabulary option:
<p>
For example, consider the following rule that distinguishes between sets (comma-separated lists of words) and parallel assignments (one list assigned to another):
</p>
<pre><tt>stat: ( list "=" )=> list "=" list
| list
<p>
Sometimes you want a translator to ignore but not discard portions of the input during the recognition phase. For example, you want to ignore comments vis-a-vis parsing, but you need the comments for translation. The solution is to send the comments to the parser on a <em>hidden</em> token stream--one that the parser is not "listening" to. During recognition, actions can then examine the hidden stream or streams, collecting the comments and so on. Stream-splitting filters are like prisms that split white light into rainbows.
</p>
<pre>int n; // list length
</p>
<pre><font face="Courier New">// list length</font></pre>
<p>
As the tokens are consumed, the <small><font face="Courier New">TokenStreamHiddenTokenFilter</font></small> object hooks the hidden tokens to the main tokens via linked list. There is only one physical TokenStream of tokens emanating from this filter and the interweaved pointers maintain sequence information.
<p>
The selector can maintain of list of streams for you so that you can switch to another input stream by name or you can tell it to switch to an actual stream object.
// Start preprocessor. This strips generates an argument list
boolean preprocess_ok = preTool.preprocess();
String[] modifiedArgs = preTool.preprocessedArgList();
/** Parse a list such as "f1.g;f2.g;..." and return a Vector
*/
public static Vector parseSeparatedList(String list, char separator) {
java.util.StringTokenizer st =
new java.util.StringTokenizer(list, String.valueOf(separator));
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
protected List<T> _list;
{
_list = new List<T>();
_parent = parent;
_list = new List<T>();
protected NodeCollection(Node parent, IEnumerable<T> list)
{
if (null == list) throw new ArgumentNullException("list");
_parent = parent;
_list = new List<T>(list);
//
// With many thanks to Eric V. Smith from the ANTLR list.
}
// move to list of children
* in the generated constructor instead).
* @param bitsetList The list of bitsets to generate.
*/
protected void genBitsets( Vector bitsetList, int maxVocabulary ) {
println("");
for (int i = 0; i < bitsetList.size(); i++)
{
BitSet p = (BitSet)bitsetList.elementAt(i);
// do anything with it. call that will inform
// SemanticPredicateListeners of the result
// if debugging, wrap the semantic predicate evaluation in a method
// that can tell SemanticPredicateListeners the result