public LexerToken(string rawString, int startCharIdx, int endCharIdx) { rawWord = RawWord.new_FromString(rawString); this.startCharIdx = startCharIdx; this.endCharIdx = endCharIdx; tokenType = TYPE.UNCLASSIFIED; }
// Create a new rawWord or fetch a reference public static RawWord new_FromString(string rawWordText) { // Try to fetch it from the cache. RawWord cachedRawWord; if (uniqueRawWordMap.TryGetValue(rawWordText, out cachedRawWord)) return cachedRawWord; // If we can't find it, make it, add it to the cache, and return it. RawWord newRawWord = new RawWord(rawWordText); uniqueRawWordMap.Add(rawWordText, newRawWord); return newRawWord; }
// Create a new rawWord or fetch a reference public static RawWord new_FromString(string rawWordText) { // Try to fetch it from the cache. RawWord cachedRawWord; if (uniqueRawWordMap.TryGetValue(rawWordText, out cachedRawWord)) { return(cachedRawWord); } // If we can't find it, make it, add it to the cache, and return it. RawWord newRawWord = new RawWord(rawWordText); uniqueRawWordMap.Add(rawWordText, newRawWord); return(newRawWord); }
// Given a list of contiguous (traditional) words, either look it up // and return it, or create it and return it. public Word addWordFromStrings(string[] rawStrings) { // Convert to RawWord objects. //List<RawWord[]> rawWordList = new List<RawWord[]>(); RawWord[] rawWords = new RawWord[rawStrings.Length]; int i = 0; foreach (string s in rawStrings) { rawWords[i] = RawWord.new_FromString(s); i++; } // rawWordList.Add(rawWords); return(addWordFromRawWords(rawWords)); }
public WordBase(RawWord[] words) { if (words.Length == 0) throw new ProseWordParserFailure("Attempt to construct an empty word."); // Remeber the words rawWords = words; // Compute readableString StringBuilder x = new StringBuilder(); foreach (RawWord word in words) { x.Append(word.AsString); x.Append(" "); } // Throw away the extra space at the end. x.Remove(x.Length - 1, 1); readableString = x.ToString(); }
private RawWord[] rawWordAsArray; // So we don't have to call new later #endregion Fields #region Constructors public RawWordObject(RawWord rawWord) { this.rawWord = rawWord; this.rawWordAsArray = new RawWord[] { rawWord }; // So we don't have to call new later }
public RawWordObject(RawWord rawWord) { this.rawWord = rawWord; this.rawWordAsArray = new RawWord[] { rawWord }; // So we don't have to call new later }
public WordBindingAction(RawWord[] rawWordsToBindAsWord, Word wordToInheritFrom) { this.rawWordsToBindAsWord = rawWordsToBindAsWord; parent = wordToInheritFrom; }
public ExclusiveWordBindingAction(RawWord[] rawWordsToBindAsWord, Word wordToInheritFrom) : base(rawWordsToBindAsWord, wordToInheritFrom) { bindingSymbol = "<-"; }
public Word searchWordFromRawWord(RawWord rawWord) { return(searchWordFromRawWords(new RawWord[] { rawWord })); }
public Word searchWordFromRawWord(RawWord rawWord) { return searchWordFromRawWords(new RawWord[] {rawWord}); }
public WordNotFoundException(RawWord[] rawWords, string message) : base(message) { this.rawWords = rawWords; }
public Word word(string s) { return(wordTrie.getValue(new RawWord[] { RawWord.new_FromString(s) })); }
public Word addWordFromRawWord(RawWord rawWord) { return addWordFromRawWords(new RawWord[] { rawWord }); }
// Given a list of contiguous (traditional) words, either look it up // and return it, or create it and return it. public Word addWordFromStrings(string[] rawStrings) { // Convert to RawWord objects. //List<RawWord[]> rawWordList = new List<RawWord[]>(); RawWord[] rawWords = new RawWord[rawStrings.Length]; int i=0; foreach(string s in rawStrings) { rawWords[i] = RawWord.new_FromString(s); i++; } // rawWordList.Add(rawWords); return addWordFromRawWords(rawWords); }
// Lookup/add a word to the current scope representing this list of raw words. public Word addWordFromRawWords(RawWord[] rawWords) { Word newWord = new_WordFromWords(rawWords); wordTrie.putObjectPath(rawWords, newWord); return newWord; }
public Word searchWordFromRawWords(RawWord[] rawWords) { return wordTrie.getValue(rawWords); }
// Return an object depending only on the contents of the words. public Word new_WordFromWords(RawWord[] words) { // Look for the word in the trie Word foundWord = wordTrie.getValue(words); // If it isn't there, add it if (foundWord == null) { Word newWord = new Word(words); // Create the word wordTrie.putObjectPath(words, newWord); // Put the word into the Trie with address = words return newWord; } else return foundWord; }
public MethodNameWord(RawWord[] words, ProseRuntime runtime, ProseLanguage.ActionDelegate delegateMethod ) : base(words) { this.delegateMethod = delegateMethod; isa = new Word[] { runtime.word("@method") }; }
public AssemblyNameWord(RawWord[] words, ProseRuntime runtime, Assembly assembly ) : base(words) { this.assembly = assembly; isa = new Word[] { runtime.word("@assembly") }; }
public BindTypeAction(AssemblyNameWord assemblyWord, string typeName, RawWord[] rawWords) { this.assemblyWord = assemblyWord; this.typeName = typeName; this.rawWords = rawWords; }
public Word addWordFromRawWords(RawWord[] rawWords) { return global_scope.addWordFromRawWords(rawWords); }
public MethodObject(RawWord methodName) { this.methodName = methodName; }
public Word searchWordFromRawWords(RawWord[] rawWords) { return global_scope.searchWordFromRawWords(rawWords); }
public Word(RawWord[] words) : base(words) { }
public Word addWordFromRawWord(RawWord rawWord) { return(addWordFromRawWords(new RawWord[] { rawWord })); }
public TypeNameWord(RawWord[] words, ProseRuntime runtime, Type type ) : base(words) { this.type = type; isa = new Word[] { runtime.word("@type") }; }
public BindMethodAction(TypeNameWord typeWord, string methodName, RawWord[] rawWords) { this.typeWord = typeWord; this.methodName = methodName; this.rawWords = rawWords; }