示例#1
0
 public LexerToken(string rawString, int startCharIdx, int endCharIdx)
 {
     rawWord           = RawWord.new_FromString(rawString);
     this.startCharIdx = startCharIdx;
     this.endCharIdx   = endCharIdx;
     tokenType         = TYPE.UNCLASSIFIED;
 }
示例#2
0
 public LexerToken(string rawString, int startCharIdx, int endCharIdx)
 {
     rawWord = RawWord.new_FromString(rawString);
     this.startCharIdx = startCharIdx;
     this.endCharIdx = endCharIdx;
     tokenType = TYPE.UNCLASSIFIED;
 }
示例#3
0
文件: RawWord.cs 项目: FizzyP/Prose
        //    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;
        }
示例#4
0
        //	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);
        }
示例#5
0
        //	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));
        }
示例#6
0
文件: WordBase.cs 项目: FizzyP/Prose
        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();
        }
示例#7
0
        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
        }
示例#8
0
 public RawWordObject(RawWord rawWord)
 {
     this.rawWord        = rawWord;
     this.rawWordAsArray = new RawWord[] { rawWord };                            //	So we don't have to call new later
 }
示例#9
0
 public WordBindingAction(RawWord[] rawWordsToBindAsWord, Word wordToInheritFrom)
 {
     this.rawWordsToBindAsWord = rawWordsToBindAsWord;
     parent = wordToInheritFrom;
 }
示例#10
0
 public ExclusiveWordBindingAction(RawWord[] rawWordsToBindAsWord, Word wordToInheritFrom)
     : base(rawWordsToBindAsWord, wordToInheritFrom)
 {
     bindingSymbol = "<-";
 }
示例#11
0
 public Word searchWordFromRawWord(RawWord rawWord)
 {
     return(searchWordFromRawWords(new RawWord[] { rawWord }));
 }
示例#12
0
 public Word searchWordFromRawWord(RawWord rawWord)
 {
     return searchWordFromRawWords(new RawWord[] {rawWord});
 }
示例#13
0
 public WordNotFoundException(RawWord[] rawWords, string message)
     : base(message)
 {
     this.rawWords = rawWords;
 }
示例#14
0
 public Word word(string s)
 {
     return(wordTrie.getValue(new RawWord[] { RawWord.new_FromString(s) }));
 }
示例#15
0
 public Word addWordFromRawWord(RawWord rawWord)
 {
     return addWordFromRawWords(new RawWord[] { rawWord });
 }
示例#16
0
        //    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);
        }
示例#17
0
 //    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;
 }
示例#18
0
 public Word searchWordFromRawWords(RawWord[] rawWords)
 {
     return wordTrie.getValue(rawWords);
 }
示例#19
0
 //    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;
 }
示例#20
0
 public MethodNameWord(RawWord[] words, ProseRuntime runtime, ProseLanguage.ActionDelegate delegateMethod )
     : base(words)
 {
     this.delegateMethod = delegateMethod;
     isa = new Word[] { runtime.word("@method") };
 }
示例#21
0
 public AssemblyNameWord(RawWord[] words, ProseRuntime runtime, Assembly assembly )
     : base(words)
 {
     this.assembly = assembly;
     isa = new Word[] { runtime.word("@assembly") };
 }
示例#22
0
 public BindTypeAction(AssemblyNameWord assemblyWord, string typeName, RawWord[] rawWords)
 {
     this.assemblyWord = assemblyWord;
     this.typeName = typeName;
     this.rawWords = rawWords;
 }
示例#23
0
 public Word addWordFromRawWords(RawWord[] rawWords)
 {
     return global_scope.addWordFromRawWords(rawWords);
 }
示例#24
0
 public MethodObject(RawWord methodName)
 {
     this.methodName = methodName;
 }
示例#25
0
 public Word searchWordFromRawWords(RawWord[] rawWords)
 {
     return global_scope.searchWordFromRawWords(rawWords);
 }
示例#26
0
文件: Word.cs 项目: FizzyP/Prose
 public Word(RawWord[] words)
     : base(words)
 {
 }
示例#27
0
 public Word addWordFromRawWord(RawWord rawWord)
 {
     return(addWordFromRawWords(new RawWord[] { rawWord }));
 }
示例#28
0
 public TypeNameWord(RawWord[] words, ProseRuntime runtime, Type type )
     : base(words)
 {
     this.type = type;
     isa = new Word[] { runtime.word("@type") };
 }
示例#29
0
 public BindMethodAction(TypeNameWord typeWord, string methodName, RawWord[] rawWords)
 {
     this.typeWord = typeWord;
     this.methodName = methodName;
     this.rawWords = rawWords;
 }
示例#30
0
 public MethodObject(RawWord methodName)
 {
     this.methodName = methodName;
 }