Example #1
0
 private static ReduceAction CreateReduceAction(ActionSubRecord record, SymbolCollection symbols,
     RuleCollection rules)
 {
     SymbolTerminal symbol = symbols[record.SymbolIndex] as SymbolTerminal;
     Rule rule = rules[record.Target];
     return new ReduceAction(symbol, rule);
 }
Example #2
0
 private static GotoAction CreateGotoAction(ActionSubRecord record, SymbolCollection symbols,
     StateCollection states)
 {
     SymbolNonterminal symbol = symbols[record.SymbolIndex] as SymbolNonterminal;
     State state = states[record.Target];
     return new GotoAction(symbol, state);
 }
        internal Transition(ITaskDefinitionSymbol containingTask, 
                            TransitionDefinitionSyntax syntax, 
                            NodeReferenceSymbol source, 
                            EdgeModeSymbol edgeMode, 
                            NodeReferenceSymbol target, 
                            SymbolCollection<TriggerSymbol> triggers)  {

            if (containingTask == null) {
                throw new ArgumentNullException(nameof(containingTask));
            }

            if (syntax == null) {
                throw new ArgumentNullException(nameof(syntax));
            }

            ContainingTask = containingTask;
            Syntax   = syntax;
            Source   = source;
            EdgeMode = edgeMode;
            Target   = target;
            Triggers = triggers??new SymbolCollection<TriggerSymbol>();

            foreach (var trigger in Triggers) {
                trigger.Transition = this;
            }
        }
Example #4
0
        public Grammar()
        {
            Options     = RuntimeOptions.Default;

            Productions = new ProductionCollection(this);
            Symbols     = new SymbolCollection(this);
            Conditions  = new ConditionCollection(this);
            Matchers    = new MatcherCollection(this);
            Mergers     = new MergerCollection(this);
            Contexts    = new ForeignContextCollection(this);
            Reports     = new ReportCollection();
            GlobalContextProvider = new ForeignContextProvider { Owner = this.Contexts };
            Joint       = new Joint();

            for (int i = PredefinedTokens.Count; i != 0; --i)
            {
                Symbols.Add(null); // stub
            }

            Symbols[PredefinedTokens.Propagated]      = new Symbol("#");
            Symbols[PredefinedTokens.Epsilon]         = new Symbol("$eps");
            Symbols[PredefinedTokens.AugmentedStart]  = new Symbol("$start");
            Symbols[PredefinedTokens.Eoi]             = new Symbol("$")
                                          {
                                              Categories = SymbolCategory.DoNotInsert
                                                         | SymbolCategory.DoNotDelete
                                          };
            Symbols[PredefinedTokens.Error]           = new Symbol("$error");

            AugmentedProduction = Productions.Define((Symbol)Symbols[PredefinedTokens.AugmentedStart], new Symbol[] { null });
        }
 public CodeGenerationUnitBuilder() {
     _diagnostics      = new List<Diagnostic>();
     _taskDeclarations = new SymbolCollection<TaskDeclarationSymbol>();
     _taskDefinitions  = new SymbolCollection<TaskDefinitionSymbol>();
     _includes         = new SymbolCollection<IncludeSymbol>();
     _codeUsings       = new List<string>();
     _symbols          = new List<ISymbol>();
 }
        public TaskDeclarationResult(IReadOnlyList<Diagnostic> diagnostics, 
                                     SymbolCollection<TaskDeclarationSymbol> taskDeklarations, 
                                     SymbolCollection<IncludeSymbol> includes) {

            Diagnostics      = diagnostics      ?? new List<Diagnostic>();
            TaskDeklarations = taskDeklarations ?? new SymbolCollection<TaskDeclarationSymbol>();
            Includes         = includes         ?? new SymbolCollection<IncludeSymbol>();
        }
Example #7
0
 private static ShiftAction CreateShiftAction(ActionSubRecord record, SymbolCollection symbols,
     StateCollection states)
 {
     State state = states[record.Target];
     SymbolTerminal symbol = symbols[record.SymbolIndex] as SymbolTerminal;
     //todo: exception symbol type
     return new ShiftAction(symbol, state);
 }
Example #8
0
 /// <summary>
 /// Constructs a Fortran compiler object with the given options.
 /// </summary>
 /// <param name="opts">Compiler options</param>
 public Compiler(FortranOptions opts)
 {
     _globalSymbols = new SymbolCollection("Global"); // Functions and Subroutines
     _localSymbols = new SymbolCollection("Local"); // Everything else including labels
     _ptree = new CollectionParseNode();
     _messages = new MessageCollection(opts);
     _entryPointName = "Main";
     _opts = opts;
 }
 public TaskDefinitionSymbol(string name, 
                             Location location, 
                             TaskDefinitionSyntax syntax, 
                             TaskDeclarationSymbol taskDeclaration) : base(name, location) {
     Syntax           = syntax;
     AsTaskDeclaration  = taskDeclaration;
     NodeDeclarations = new SymbolCollection<INodeSymbol>();
     Transitions      = new List<Transition>();
     ExitTransitions  = new List<ExitTransition>();
 }
 public TaskDeclarationSymbol(string name, Location location, 
                             TaskDeclarationOrigin origin, 
                             bool isIncluded,
                             MemberDeclarationSyntax syntax): base(name, location) {
     Origin           = origin;
     Syntax           = syntax;
     IsIncluded       = isIncluded;
     References       = new List<ITaskNodeSymbol>();
     ConnectionPoints = new SymbolCollection<ConnectionPointSymbol>();
 }
        private static ShiftAction CreateShiftAction(ActionSubRecord record,
                                                     SymbolCollection symbols,
                                                     StateCollection states
                                                     )
        {
            State          state  = states[record.Target];
            SymbolTerminal symbol = symbols[record.SymbolIndex] as SymbolTerminal;

            //todo: exception symbol type
            return(new ShiftAction(symbol, state));
        }
Example #12
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public Reel(SymbolCollection symbolCollection)
        {
            Symbols = symbolCollection;
            Status = ReelStatus.Stop;
            MaxSpeed = 30;
            Speed = 0;
            Angle = 0;

            // 表示位置初期化
            UpdatePos(0f);
        }
Example #13
0
 public SelectSRAMSymbolEventArgs(int address, int length, string mapname, string filename1, string filename2, bool showdiffmap, SymbolCollection symColl, AddressLookupCollection adrColl)
 {
     this._address     = address;
     this._length      = length;
     this._mapname     = mapname;
     this._filename1   = filename1;
     this._filename2   = filename2;
     this._showdiffmap = showdiffmap;
     this._symbols     = symColl;
     this._addresses   = adrColl;
 }
Example #14
0
        public void AddSymbol(SymbolBase symbol)
        {
            if (mSymbols == null)
            {
                mSymbols = new SymbolCollection();
            }

            mSymbols.Add(symbol);

            ShowSymbol(symbol);
        }
Example #15
0
 public string GetSymbolNameByAddress(SymbolCollection symbols, Int32 address)
 {
     foreach (SymbolHelper sh in symbols)
     {
         if (sh.Flash_start_address == address)
         {
             return(sh.Varname);
         }
     }
     return(address.ToString());
 }
Example #16
0
 public int GetSymbolLength(SymbolCollection sc, string symbol)
 {
     foreach (SymbolHelper sh in sc)
     {
         if (sh.Varname == symbol)
         {
             return(sh.Length);
         }
     }
     return(0);
 }
Example #17
0
 public int GetSymbolAddress(SymbolCollection sc, string symbol)
 {
     foreach (SymbolHelper sh in sc)
     {
         if (sh.Varname == symbol)
         {
             return(sh.Flash_start_address);
         }
     }
     return(0);
 }
 public SelectSymbolEventArgs(int address, int length, string mapname, string filename, bool showdiffmap, SymbolCollection symColl, int symbolnumber1, int symbolnumber2)
 {
     this._address       = address;
     this._length        = length;
     this._mapname       = mapname;
     this._filename      = filename;
     this._showdiffmap   = showdiffmap;
     this._symbols       = symColl;
     this._symbolnumber1 = symbolnumber1;
     this._symbolnumber2 = symbolnumber2;
 }
        public void FindNearestSymbol(DbgViewSymbol aSymbolView)
        {
            SymbolCollection collection = null;

            iSymbol = aSymbolView.Lookup(this.Data, out collection);
            //
            if (collection != null)
            {
                // FIXME: should this be device file name if available, and host file name if all else fails?
                AssociatedBinary = Path.GetFileName(collection.FileName.FileNameInHost);
            }
        }
Example #20
0
        public void LoadDataFromFile(string filename, SymbolCollection symbols)
        {
            _fileName          = filename;
            _lastFilename      = _fileName;
            m_symbolcollection = symbols;
            FileInfo fi = new FileInfo(filename);

            m_currentfile_size = (int)fi.Length;
            OpenFile(filename);

            // ???
            //            CloseFile();

            /*
             * FileInfo fi = new FileInfo(filename);
             * long numberoflines = fi.Length/16;
             * StringBuilder sb = new StringBuilder();
             * StringBuilder sbascii = new StringBuilder();
             * using (BinaryReader br = new BinaryReader(new FileStream(filename, FileMode.Open)))
             * {
             *  int current_address = 0;
             *  for (int lcount = 0; lcount < numberoflines; lcount++)
             *  {
             *      byte[] readbytes = br.ReadBytes(16);
             *      string line = current_address.ToString("X6") + " ";
             *      for (int bcount = 0; bcount < readbytes.Length; bcount++)
             *      {
             *          byte b = (byte)readbytes.GetValue(bcount);
             *          line += b.ToString("X2") + " ";
             *      }
             *      string line_ascii = string.Empty;
             *      for (int bcount = 0; bcount < readbytes.Length; bcount++)
             *      {
             *          byte b = (byte)readbytes.GetValue(bcount);
             *          if (b >= 0x20 && b <= 0x7f)
             *          {
             *              line_ascii += Convert.ToChar( b);
             *          }
             *          else
             *          {
             *              line_ascii += ".";
             *          }
             *      }
             *      sb.AppendLine(line);
             *      sbascii.AppendLine(line_ascii);
             *      current_address += 16;
             *  }
             * }
             * richTextBox1.Text = sb.ToString();
             * richTextBox2.Text = sbascii.ToString();
             *
             * //MessageBox.Show(richTextBox1.Find("ox1_filt_coef").ToString());*/
        }
Example #21
0
        internal IEnumerable <QuoteRange> GetYRange(double low, double high)
        {
            IEnumerable <QuoteRange> ranges = (new QuoteRange[] { DataService.Instance.GetSymbolYRange(DataSource, low, high, this.Binding) });

            if (SymbolCollection != null && SymbolCollection.Any())
            {
                var cssRange = from cs in SymbolCollection where cs.Visibility == SeriesVisibility.Visible select DataService.Instance.GetSymbolYRange(cs.DataSource, low, high, this.Binding);

                ranges = ranges.Union(cssRange);
            }
            return(ranges);
        }
Example #22
0
 public SelectSymbolEventArgs(int address, int length, string mapname, string filename, bool showdiffmap, SymbolCollection symColl, AddressLookupCollection adrColl, Trionic5File _file, Trionic5FileInformation _fileinfo)
 {
     this._address                      = address;
     this._length                       = length;
     this._mapname                      = mapname;
     this._filename                     = filename;
     this._showdiffmap                  = showdiffmap;
     this._symbols                      = symColl;
     this._addresses                    = adrColl;
     this.m_CompTrionic5File            = _file;
     this.m_CompTrionic5FileInformation = _fileinfo;
 }
        /// <summary>
        /// Fill auto list with symbols when a ':' appears.
        /// This is for "method" calls in Lua like self:DoSomething()
        /// </summary>
        /// <param name="sciWordBeforeOperator">The word preceding the operator.</param>
        /// <param offset>The offset/number of characters in front of the operator
        /// (e.g. is 6 for manual invocation of 'Debug:PrintL'). This is always 0 for automatic
        /// invocation at the position of the operator</param>
        /// <returns>A list of symbols for the current request (maybe null).</returns>
        private SymbolCollection HandleColonOperator(string sciWordBeforeOperator, int offset)
        {
            Scintilla        SciControl = _currentDoc.ScintillaControl;
            CaretInfo        caret      = SciControl.Caret;
            SymbolCollection list       = null;

            // access to a variable's members
            // for now, simply add every member function (note: no member variables) that were defined
            if (sciWordBeforeOperator == "self")
            {
                //note: we are not sure if 'self' is really a base entity
                list = ScriptManager.GetFunctionsForClass("VisBaseEntity_cl *");

                if (list == null)
                {
                    list = new SymbolCollection();
                }

                //add the callbacks defined in the file (or which could be defined)
                foreach (String callback in SciControl.Lexing.Keywords[LUA_PATTERN_CALLBACKS_CLASSES_IDX].Split(' '))
                {
                    if (SciControl.Text.Contains(callback))
                    {
                        list.Add(new SymbolInfo(callback, SymbolType.FUNCTION));
                    }
                    else
                    {
                        list.Add(new SymbolInfo(callback, SymbolType.CONSTANT));
                    }
                }
            }
            else
            {
                //dig down like this: abc.efg.hij:blah()
                int    iDepth  = 1;
                string command = sciWordBeforeOperator;
                while (SciControl.CharAt(caret.Position - 1 - command.Length - iDepth - offset) == '.')
                {
                    iDepth++;
                    command = SciControl.GetWordFromPosition(caret.Position - 1 - command.Length - iDepth - offset) + "." + command;
                }

                list = ScriptManager.GetFunctionsFromGlobal(command);
            }

            if (list == null || list.Count == 0)
            {
                //add methods of 'self'
                list = ScriptManager.GetFunctionsFromMetaTables();
            }

            return(list);
        }
Example #24
0
        public static CilFunctionContext New(StackContext caller,
            SymbolCollection importedNamespaces)
        {
            if (caller == null)
                throw new ArgumentNullException("caller");

            if (importedNamespaces == null)
                importedNamespaces = new SymbolCollection();

            return new CilFunctionContext(caller.ParentEngine, caller.ParentApplication,
                importedNamespaces);
        }
Example #25
0
        private void TestMapGCCE()
        {
            Clear();
            iDebugEngine.Add(@"C:\Tool Demo Files\2. Crash Data\File55\GCCE\alarmserver.exe.map");
            iDebugEngine.Prime(SymbianUtils.TSynchronicity.ESynchronous);

            using (DbgEngineView view = iDebugEngine.CreateView("TestView"))
            {
                DbgViewSymbols   symView = view.Symbols;
                SymbolCollection col     = null;

                // Should be possible to activate
                col = symView.ActivateAndGetCollection(new CodeSegDefinition(@"Z:\sys\bin\alarmserver.exe", 0x70000000, 0x7FFFFFFF));
                System.Diagnostics.Debug.Assert(col != null);
                System.Diagnostics.Debug.WriteLine(col.ToString("full", null));

                // Check invalid address
                col = view.Symbols.CollectionByAddress(0x7000bcc8);
                System.Diagnostics.Debug.Assert(col == null);

                // Verify that the symbols were really read.
                col = view.Symbols.CollectionByAddress(0x7000bcc7);
                System.Diagnostics.Debug.Assert(col != null);
                col = view.Symbols.CollectionByAddress(0x70000000);
                System.Diagnostics.Debug.Assert(col != null);
                col = view.Symbols.CollectionByAddress(0x70000001);
                System.Diagnostics.Debug.Assert(col != null);
                col = view.Symbols.CollectionByAddress(0x70002001);
                System.Diagnostics.Debug.Assert(col != null);

                // Check for overlaps
                CheckNoOverlaps(col);

                // Perform some lookup tests
                string text = string.Empty;

                text = view.Symbols.PlainText[0x70000000];
                System.Diagnostics.Debug.Assert(text == "_xxxx_call_user_invariant");
                text = view.Symbols.PlainText[0x70000001];
                System.Diagnostics.Debug.Assert(text == "_xxxx_call_user_invariant");
                text = view.Symbols.PlainText[0x70000007];
                System.Diagnostics.Debug.Assert(text == "_xxxx_call_user_invariant");
                text = view.Symbols.PlainText[0x70000008];
                System.Diagnostics.Debug.Assert(text == "_xxxx_call_user_handle_exception");
                text = view.Symbols.PlainText[0x7000000f];
                System.Diagnostics.Debug.Assert(text == "_xxxx_call_user_handle_exception");
                text = view.Symbols.PlainText[0x70000070];
                System.Diagnostics.Debug.Assert(text == "CASSrvServer::CASSrvServer()");
                text = view.Symbols.PlainText[0x7000bcc7];
                System.Diagnostics.Debug.Assert(text == "typeinfo name for CASAltRequestQuietPeriodEnd");
            }
        }
        public void FillSymbolCollection(string sourcefile, SourceType type, SymbolCollection symbols, AxisCollection axis, bool applyOffset)
        {
            switch (type)
            {
            case SourceType.CSV:
                ParseCSVFile(sourcefile, symbols, axis, applyOffset);
                break;

            case SourceType.Damos:
                ParseDamosFile(sourcefile, symbols, axis, applyOffset);
                break;
            }
        }
Example #27
0
        internal Symbol LookUpSymbol(uint aAddress, out SymbolCollection aCollection)
        {
            Symbol ret = null;

            aCollection = null;
            //
            if (iDebugEngineView != null)
            {
                ret = iDebugEngineView.Symbols.Lookup(aAddress, out aCollection);
            }
            //
            return(ret);
        }
 public void SetSymbolList(SymbolCollection sc)
 {
     lookUpEdit1.Properties.DisplayMember = "Varname";
     lookUpEdit1.Properties.ValueMember   = "Varname";
     lookUpEdit2.Properties.DisplayMember = "Varname";
     lookUpEdit2.Properties.ValueMember   = "Varname";
     lookUpEdit3.Properties.DisplayMember = "Varname";
     lookUpEdit3.Properties.ValueMember   = "Varname";
     lookUpEdit1.Properties.DataSource    = sc;
     lookUpEdit2.Properties.DataSource    = sc;
     lookUpEdit3.Properties.DataSource    = sc;
     _symbols = sc;
 }
Example #29
0
 private CilFunctionContext(Engine parentEngine, Application parentApplication,
     SymbolCollection importedNamespaces)
 {
     if (parentEngine == null)
         throw new ArgumentNullException("parentEngine");
     this.parentEngine = parentEngine;
     if (parentApplication == null)
         throw new ArgumentNullException("parentApplication");
     this.parentApplication = parentApplication;
     if (importedNamespaces == null)
         throw new ArgumentNullException("importedNamespaces");
     this.importedNamespaces = importedNamespaces;
 }
Example #30
0
        private int SymbolCountOfLength(SymbolCollection sc, int symbollength)
        {
            int retval = 0;

            foreach (SymbolHelper sh in sc)
            {
                if (sh.Length == symbollength)
                {
                    retval++;
                }
            }
            return(retval);
        }
Example #31
0
        public SymbolListView()
        {
            mSymbols = null;

            InitializeComponent();

            mSymbolValueTextBox.MinValue = ValueSymbol.MinValue;
            mSymbolValueTextBox.MaxValue = ValueSymbol.MaxValue;
            mSymbolNameTextBox.MaxLength = ValueSymbol.MaxNameLength;

            mSymbolNameTextBox.TextChanged  += MSymbolNameTextBox_TextChanged;
            mSymbolValueTextBox.TextChanged += MSymbolValueTextBox_TextChanged;
            mListView.SelectedIndexChanged  += MListView_SelectedIndexChanged;
        }
Example #32
0
        public override FileInformation ParseFile()
        {
            m_fileInfo = new FileInformation();
            SymbolCollection symbols = new SymbolCollection();
            AxisCollection   axis    = new AxisCollection();

            LoadLH242File(m_currentFile, out symbols, out axis);
            m_symbols = symbols;
            m_axis    = axis;

            m_fileInfo.Symbols = symbols;
            m_fileInfo.Axis    = axis;
            return(m_fileInfo);
        }
        public SymbolCollectionHarmoniser(SymbolCollection aCollection, TCollectionType aType)
        {
            iCollection = aCollection;
            iType       = aType;

            // If the collection is not XIP, then we can definitely say it is relocatable
            if (aType == TCollectionType.ENotXIP)
            {
                iCollection.IsFixed = false;
            }
            else if (aType == TCollectionType.EXIP)
            {
                iCollection.IsFixed = true;
            }
        }
Example #34
0
        void MSetButton_Click(object sender, EventArgs e)
        {
            if (mSymbols == null)
            {
                mSymbols = new SymbolCollection();
            }

            string symbolName      = mSymbolNameTextBox.Text;
            long   symbolMagnitude = mSymbolValueTextBox.Magnitude;

            Word.Signs  symbolSign  = mSymbolValueTextBox.Sign;
            SymbolBase  symbol      = mSymbols[symbolName];
            ValueSymbol valueSymbol = null;

            if (symbol != null)
            {
                valueSymbol = symbol as ValueSymbol;
                if (valueSymbol == null)
                {
                    return;
                }

                valueSymbol.SetValue(symbolSign, symbolMagnitude);
                var valueText = symbolMagnitude.ToString();
                if (symbolSign.IsNegative())
                {
                    valueText = '-' + valueText;
                }

                mListView.Items[symbolName].SubItems[valueFieldIndex].Text = valueText;
            }
            else
            {
                valueSymbol = ValueSymbol.ParseDefinition(symbolName) as ValueSymbol;

                if (valueSymbol == null)
                {
                    return;
                }

                valueSymbol.SetValue(symbolSign, symbolMagnitude);

                mSymbols.Add(valueSymbol);
                ShowSymbol(valueSymbol);
            }

            SetEnabledStates();
        }
Example #35
0
        public void ShowSymbolCollection(SymbolCollection sc)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("SYMBOLNAME");
            dt.Columns.Add("DESCRIPTION");
            dt.Columns.Add("XAXIS");
            dt.Columns.Add("XAXISDESCRIPTION");
            dt.Columns.Add("YAXIS");
            dt.Columns.Add("YAXISDESCRIPTION");
            dt.Columns.Add("XAXISADDRESS");
            dt.Columns.Add("YAXISADDRESS");
            //SymbolAxesTranslator sat = new SymbolAxesTranslator();
            //SymbolTranslator symtrans = new SymbolTranslator();
            string         helptext = string.Empty;
            XDFCategories  cat      = XDFCategories.Undocumented;
            XDFSubCategory subcat   = XDFSubCategory.Undocumented;

            foreach (SymbolHelper sh in sc)
            {
                string xaxis        = sh.XDescr;
                string yaxis        = sh.YDescr;
                string symboldescr  = sh.Varname;//symtrans.TranslateSymbolToHelpText(sh.Varname, out helptext, out cat, out subcat);
                string xaxisdescr   = "";
                string xaxisaddress = GetXAxisAddress(sc, sh.Varname);
                string yaxisaddress = GetYAxisAddress(sc, sh.Varname);
                if (sh.X_axisvalues != null)
                {
                    foreach (float fval in sh.X_axisvalues)
                    {
                        xaxisdescr += fval.ToString("F2") + " ";
                    }
                }
                string yaxisdescr = "";
                if (sh.Y_axisvalues != null)
                {
                    foreach (float fval in sh.Y_axisvalues)
                    {
                        yaxisdescr += fval.ToString("F2") + " ";
                    }
                }
                if (xaxis != "" || yaxis != "")
                {
                    dt.Rows.Add(sh.Varname, symboldescr, xaxis, xaxisdescr, yaxis, yaxisdescr, xaxisaddress, yaxisaddress);
                }
            }
            gridControl1.DataSource = dt;
        }
Example #36
0
        private void TestMapRVCT()
        {
            Clear();
            iDebugEngine.Add(@"C:\Tool Demo Files\2. Crash Data\File55\RVCT\alarmserver.exe.map");
            iDebugEngine.Prime(SymbianUtils.TSynchronicity.ESynchronous);

            using (DbgEngineView view = iDebugEngine.CreateView("TestView"))
            {
                DbgViewSymbols   symView = view.Symbols;
                SymbolCollection col     = null;

                // Should be possible to activate
                col = symView.ActivateAndGetCollection(new CodeSegDefinition(@"Z:\sys\bin\alarmserver.exe", 0x70000000, 0x7FFFFFFF));
                System.Diagnostics.Debug.Assert(col != null);
                System.Diagnostics.Debug.WriteLine(col.ToString("full", null));

                // Check invalid address
                col = view.Symbols.CollectionByAddress(0x700090a5);
                System.Diagnostics.Debug.Assert(col == null);

                // Verify that the symbols were really read.
                col = view.Symbols.CollectionByAddress(0x700090a4);
                System.Diagnostics.Debug.Assert(col != null);
                col = view.Symbols.CollectionByAddress(0x70000000);
                System.Diagnostics.Debug.Assert(col != null);
                col = view.Symbols.CollectionByAddress(0x70000001);
                System.Diagnostics.Debug.Assert(col != null);
                col = view.Symbols.CollectionByAddress(0x70002001);
                System.Diagnostics.Debug.Assert(col != null);

                // Check for overlaps
                CheckNoOverlaps(col);

                // Perform some lookup tests
                string text = string.Empty;

                text = view.Symbols.PlainText[0x70000000];
                System.Diagnostics.Debug.Assert(text == "_E32Startup");
                text = view.Symbols.PlainText[0x70000001];
                System.Diagnostics.Debug.Assert(text == "_E32Startup");
                text = view.Symbols.PlainText[0x7000006f];
                System.Diagnostics.Debug.Assert(text == "_E32Startup");
                text = view.Symbols.PlainText[0x70000070];
                System.Diagnostics.Debug.Assert(text == "__cpp_initialize__aeabi_");
                text = view.Symbols.PlainText[0x700090a4];
                System.Diagnostics.Debug.Assert(text == ".ARM.exidx$$Limit");
            }
        }
Example #37
0
        private static void WriteSymbolTree(ReadOnlySymbolCollection symbolLoaderSymbols, AdsConnection connection)
        {
            Console.WriteLine("\t");
            foreach (var symbolLoaderSymbol in symbolLoaderSymbols)
            {
                Console.Write(symbolLoaderSymbol.InstancePath);

                // var symbolInfo = client.ReadSymbolInfo(symbolLoaderSymbol.InstancePath);
                // var symbolInfor = new symbolin
                try
                {
                    if (symbolLoaderSymbol is ISymbol info)
                    {
                        if (info.Category == DataTypeCategory.Primitive)
                        {
                            SymbolCollection coll = new SymbolCollection()
                            {
                                symbolLoaderSymbol
                            };
                            SumSymbolRead readCommand = new SumSymbolRead(connection, coll);
                            object[]      values      = readCommand.Read();
                            Console.Write(": " + values.FirstOrDefault());
                        }
                        else
                        {
                            Console.Write(": " + info.Category);
                        }
                    }
                    else
                    {
                        Console.Write(": -");
                    }
                }
                catch (Exception e)
                {
                    var type   = symbolLoaderSymbol.DataType.GetType();
                    var symbol = connection.ReadSymbol(symbolLoaderSymbol.InstanceName, symbolLoaderSymbol.DataType.GetType(), true);
                    Console.Write("Exception: " + e);
                }

                Console.WriteLine(string.Empty);
                if (symbolLoaderSymbol.SubSymbols.Any())
                {
                    Console.WriteLine("__________subs to " + symbolLoaderSymbol.InstancePath);
                    WriteSymbolTree(symbolLoaderSymbol.SubSymbols, connection);
                }
            }
        }
        public void ExportPackage(SymbolCollection sc, string filename, string packagefilename)
        {
            if (File.Exists(packagefilename))
            {
                File.Delete(packagefilename);
            }

            foreach (SymbolHelper sh in sc)
            {
                if (sh.Flash_start_address > 0 && sh.Flash_start_address < 0x100000)
                {
                    byte[] data = readdatafromfile(filename, (int)sh.Flash_start_address, sh.Length);
                    ExportMap(packagefilename, sh.Varname, sh.Userdescription, sh.Length, data);
                }
            }
        }
Example #39
0
        private void CheckNoOverlaps(SymbolCollection aCollection)
        {
            int count = aCollection.Count;

            for (int i = 0; i < count - 1; i++)
            {
                Symbol s1 = aCollection[i + 0];
                Symbol s2 = aCollection[i + 1];
                //
                System.Diagnostics.Debug.WriteLine("Comparing: " + s1 + " vs " + s2);
                //
                System.Diagnostics.Debug.Assert(s1.AddressRange.Min <= s1.AddressRange.Max);
                System.Diagnostics.Debug.Assert(s1.AddressRange.Min < s2.AddressRange.Min);
                System.Diagnostics.Debug.Assert(s1.AddressRange.Max < s2.AddressRange.Min);
            }
        }
        internal Transition(TransitionDefinitionSyntax syntax, 
                            NodeReferenceSymbol source, 
                            EdgeModeSymbol edgeMode, 
                            NodeReferenceSymbol target, 
                            SymbolCollection<TriggerSymbol> triggers)  {

            if (syntax == null) {
                throw new ArgumentNullException(nameof(syntax));
            }

            Syntax   = syntax;
            Source   = source;
            EdgeMode = edgeMode;
            Target   = target;
            Triggers = triggers??new SymbolCollection<TriggerSymbol>();
        }
Example #41
0
        private Symbol FindByName(string aName, SymbolCollection aCollection)
        {
            Symbol ret = null;

            //
            foreach (Symbol sym in aCollection)
            {
                if (sym.Name == aName)
                {
                    ret = sym;
                    break;
                }
            }
            //
            return(ret);
        }
        public static void AddSymbolBasedOn(this SymbolCollection symbols, string strRep, string basedOnStrRep, params FeatureSymbol[] values)
        {
            Symbol basedOnSymbol;

            if (!symbols.Contains(strRep) &&
                symbols.TryGetValue(basedOnStrRep, out basedOnSymbol))
            {
                FeatureStruct fs = basedOnSymbol.FeatureStruct.DeepClone();
                foreach (FeatureSymbol value in values)
                {
                    fs.AddValue(value.Feature, value);
                }
                fs.Freeze();
                symbols.Add(strRep, fs);
            }
        }
Example #43
0
 /// <summary>
 /// Creates a new action by specifying the needed information.
 /// </summary>
 /// <param name="record">A part of the LALR record from the file content.</param>
 /// <param name="states">The LALR states.</param>
 /// <param name="symbols">The symbols.</param>
 /// <param name="rules">The rules.</param>
 /// <returns>A new action object.</returns>
 public static Action CreateAction(ActionSubRecord record,
     StateCollection states,
     SymbolCollection symbols,
     RuleCollection rules)
 {
     Action action;
     switch (record.Action)
     {
         case 1: action = CreateShiftAction(record,symbols,states); break;
         case 2: action = CreateReduceAction(record,symbols,rules); break;
         case 3: action = CreateGotoAction(record,symbols,states); break;
         case 4: action = CreateAcceptAction(record,symbols); break;
         default: return null; //todo: make exception
     }
     return action;
 }
Example #44
0
        public void ShowSymbolCollection(SymbolCollection sc)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("SYMBOLNAME");
            dt.Columns.Add("DESCRIPTION");
            dt.Columns.Add("XAXIS");
            dt.Columns.Add("XAXISDESCRIPTION");
            dt.Columns.Add("YAXIS");
            dt.Columns.Add("YAXISDESCRIPTION");
            SymbolAxesTranslator sat = new SymbolAxesTranslator();

            SymbolTranslator symtrans   = new SymbolTranslator();
            string           helptext   = string.Empty;
            XDFCategories    cat        = XDFCategories.Undocumented;
            XDFSubCategory   subcat     = XDFSubCategory.Undocumented;
            string           xaxis      = string.Empty;
            string           yaxis      = string.Empty;
            string           xaxisdescr = "";
            string           yaxisdescr = "";
            string           zaxisdescr = "";

            foreach (SymbolHelper sh in sc)
            {
                string name = sh.Varname;
                if (sh.Userdescription != "" && sh.Userdescription != String.Format("Symbolnumber {0}", sh.Symbol_number))
                {
                    name = sh.Userdescription;
                }

                sat.GetAxisSymbols(name, out xaxis, out yaxis, out xaxisdescr, out yaxisdescr, out zaxisdescr);
                string symboldescr = symtrans.TranslateSymbolToHelpText(name, out helptext, out cat, out subcat, m_ApplicationLanguage);
                if (xaxis != "")
                {
                    xaxisdescr = symtrans.TranslateSymbolToHelpText(xaxis, out helptext, out cat, out subcat, m_ApplicationLanguage);
                }
                if (yaxis != "")
                {
                    yaxisdescr = symtrans.TranslateSymbolToHelpText(yaxis, out helptext, out cat, out subcat, m_ApplicationLanguage);
                }
                if (xaxis != "" || yaxis != "")
                {
                    dt.Rows.Add(name, symboldescr, xaxis, xaxisdescr, yaxis, yaxisdescr);
                }
            }
            gridControl1.DataSource = dt;
        }
Example #45
0
 private void SetMapNameByIndex(SymbolCollection sc, int symbolnumber, int symbollength, string mapname)
 {
     foreach (SymbolHelper sh in sc)
     {
         if (sh.Symbol_number == symbolnumber && sh.Flash_start_address < 0x100000)
         {
             if (sh.Length == symbollength)
             {
                 if (sh.Userdescription == string.Empty)
                 {
                     sh.Userdescription = mapname;
                     break;
                 }
             }
         }
     }
 }
Example #46
0
        public Segmenter(SpanFactory<ShapeNode> spanFactory)
        {
            _spanFactory = spanFactory;
            _vowels = new SymbolCollection();
            _vowels.CollectionChanged += SymbolCollectionChanged;
            _consonants = new SymbolCollection();
            _consonants.CollectionChanged += SymbolCollectionChanged;
            _modifiers = new SymbolCollection();
            _modifiers.CollectionChanged += SymbolCollectionChanged;
            _joiners = new SymbolCollection();
            _joiners.CollectionChanged += SymbolCollectionChanged;
            _toneLetters = new SymbolCollection();
            _toneLetters.CollectionChanged += SymbolCollectionChanged;
            _boundaries = new SymbolCollection();
            _boundaries.CollectionChanged += SymbolCollectionChanged;

            _emptyShape = new Shape(_spanFactory, begin => new ShapeNode(_spanFactory, FeatureStruct.New().Symbol(CogFeatureSystem.AnchorType).Feature(CogFeatureSystem.StrRep).EqualTo("#").Value));
            _emptyShape.Freeze();
        }
Example #47
0
        /// <summary>
        /// 初期化処理
        /// </summary>
        public void Initialize()
        {
            // リールより後ろにある画像をロード
            _reelBg = new SpriteUV(new TextureInfo("/Application/resources/SlotReelBg.png"));
            _reelBg.Scale = new Vector2(1.0f);
            _reelBg.Quad.S = _reelBg.TextureInfo.TextureSizef;
            _reelBg.CenterSprite();
            _reelBg.Position = new Vector2(_root.Camera.CalcBounds().Size.X * 0.5f, _root.Camera.CalcBounds().Size.Y * 0.5f);

            // リールより前にある画像をロード
            _reelFg = new SpriteUV(new TextureInfo("/Application/resources/SlotReelFg.png"));
            _reelFg.Scale = new Vector2(1.0f);
            _reelFg.Quad.S = _reelBg.TextureInfo.TextureSizef;
            _reelFg.CenterSprite();
            _reelFg.Position = new Vector2(_root.Camera.CalcBounds().Size.X * 0.5f, _root.Camera.CalcBounds().Size.Y * 0.5f);

            // 各リールを表示するためのノードを作成する
            _nodeLeft = new Node();
            _nodeCenter = new Node();
            _nodeRight = new Node();

            // 各シンボルは辞書に保存しておく
            _symbolDic = new Dictionary<Symbol.SymbolType, Symbol>();
            _symbolDic.Add(Symbol.SymbolType.Bar, new Symbol("/Application/resources/Bar.png",Symbol.SymbolType.Bar));
            _symbolDic.Add(Symbol.SymbolType.Bell, new Symbol("/Application/resources/Bell.png",Symbol.SymbolType.Bell));
            _symbolDic.Add(Symbol.SymbolType.BlueSeven, new Symbol("/Application/resources/BlueSeven.png",Symbol.SymbolType.BlueSeven));
            _symbolDic.Add(Symbol.SymbolType.Cherry, new Symbol("/Application/resources/Cherry.png",Symbol.SymbolType.Cherry));
            _symbolDic.Add(Symbol.SymbolType.Orange, new Symbol("/Application/resources/Orange.png",Symbol.SymbolType.Orange));
            _symbolDic.Add(Symbol.SymbolType.RedSeven, new Symbol("/Application/resources/RedSeven.png",Symbol.SymbolType.RedSeven));
            _symbolDic.Add(Symbol.SymbolType.Reply, new Symbol("/Application/resources/Reply.png",Symbol.SymbolType.Reply));
            _symbolDic.Add(Symbol.SymbolType.Watermelon, new Symbol("/Application/resources/Watermelon.png",Symbol.SymbolType.Watermelon));

            // 図柄コンテナクラスを作成。引数は図柄のWidthとHeight
            _symbolsLeft = new SymbolCollection(128, 128);
            _symbolsCenter = new SymbolCollection(128, 128);
            _symbolsRight = new SymbolCollection(128, 128);

            #if true
            // 左側リールの図柄設定
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);

            // 中央リールの図柄設定
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);

            // 右側リールの図柄設定
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            #else
            // 左側リールの図柄設定
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);

            // 中央リールの図柄設定
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);

            // 右側リールの図柄設定
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);
            _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]);

            #endif

            // リールインスタンス作成
            _reelLeft = new Reel(_symbolsLeft);
            _reelCenter = new Reel(_symbolsCenter);
            _reelRight = new Reel(_symbolsRight);

            // 停止イベントハンドラ設定
            _reelLeft.Stopped += OnStopped;
            _reelCenter.Stopped += OnStopped;
            _reelRight.Stopped += OnStopped;

            // リールリストに各リールを設定
            ReelList.Add(_reelLeft);
            ReelList.Add(_reelCenter);
            ReelList.Add(_reelRight);

            // 表示位置設定
            // 左側のリール
            _nodeLeft.Position = new Vector2(
                _root.Camera.CalcBounds().Size.X * 0.5f - _symbolsLeft.Width - 32,
                _root.Camera.CalcBounds().Size.Y * 0.5f);

            // 中央のリール
            _nodeCenter.Position = new Vector2(
                _root.Camera.CalcBounds().Size.X * 0.5f,
                _root.Camera.CalcBounds().Size.Y * 0.5f);

            // 右側のリール
            _nodeRight.Position = new Vector2(
                _root.Camera.CalcBounds().Size.X * 0.5f + _symbolsLeft.Width + 32,
                _root.Camera.CalcBounds().Size.Y * 0.5f);

            // 図柄を各リールの子ノードとして追加する
            foreach(var symbol in _symbolsLeft)
            {
                _nodeLeft.AddChild(symbol.Image);
            }

            foreach(var symbol in _symbolsCenter)
            {
                _nodeCenter.AddChild(symbol.Image);
            }

            foreach(var symbol in _symbolsRight)
            {
                _nodeRight.AddChild(symbol.Image);
            }

            // ReelViewの子ノードとして追加
            AddChild(_reelBg);
            AddChild(_reelFg, 100);	// 前面に表示するため、優先順位を上げる
            AddChild(_nodeLeft);
            AddChild(_nodeCenter);
            AddChild(_nodeRight);
        }
Example #48
0
 private static AcceptAction CreateAcceptAction(ActionSubRecord record,
     SymbolCollection symbols)
 {
     SymbolTerminal symbol = symbols[record.SymbolIndex] as SymbolTerminal;
     return new AcceptAction(symbol);
 }
        /// <summary>
        /// Fill auto list with symbols when a ':' appears.
        /// This is for "method" calls in Lua like self:DoSomething()
        /// </summary>
        /// <param name="sciWordBeforeOperator">The word preceding the operator.</param>
        /// <param offset>The offset/number of characters in front of the operator
        /// (e.g. is 6 for manual invocation of 'Debug:PrintL'). This is always 0 for automatic
        /// invocation at the position of the operator</param>
        /// <returns>A list of symbols for the current request (maybe null).</returns>
        private SymbolCollection HandleColonOperator(string sciWordBeforeOperator, int offset)
        {
            Scintilla SciControl = _currentDoc.ScintillaControl;
              CaretInfo caret = SciControl.Caret;
              SymbolCollection list = null;

              // access to a variable's members
              // for now, simply add every member function (note: no member variables) that were defined
              if (sciWordBeforeOperator == "self")
              {
            //note: we are not sure if 'self' is really a base entity
            list = ScriptManager.GetFunctionsForClass("VisBaseEntity_cl *");

            if (list == null) list = new SymbolCollection();

            //add the callbacks defined in the file (or which could be defined)
            foreach (String callback in SciControl.Lexing.Keywords[LUA_PATTERN_CALLBACKS_CLASSES_IDX].Split(' '))
            {
              if (SciControl.Text.Contains(callback))
            list.Add(new SymbolInfo(callback, SymbolType.FUNCTION));
              else
            list.Add(new SymbolInfo(callback, SymbolType.CONSTANT));
            }
              }
              else
              {
            //dig down like this: abc.efg.hij:blah()
            int iDepth = 1;
            string command = sciWordBeforeOperator;
            while (SciControl.CharAt(caret.Position - 1 - command.Length - iDepth - offset) == '.')
            {
              iDepth++;
              command = SciControl.GetWordFromPosition(caret.Position - 1 - command.Length - iDepth - offset) + "." + command;
            }

            list = ScriptManager.GetFunctionsFromGlobal(command);
              }

              if (list == null || list.Count == 0)
              {
            //add methods of 'self'
            list = ScriptManager.GetFunctionsFromMetaTables();
              }

              return list;
        }
Example #50
0
        /// Starts a subroutine block. For this, we create a separate symbol table
        /// to supplement the main one.
        ParseNode KSubFunc(SymClass klass, string methodName, SymFullType returnType)
        {
            ProcedureParseNode node = new ProcedureParseNode();
            EnsureNoLabel();

            // Add the name to the global scope, ensuring it hasn't already been
            // defined.
            if (methodName == null) {
                IdentifierToken identToken = ExpectIdentifierToken();
                if (identToken == null) {
                    SkipToEndOfLine();
                    return null;
                }
                methodName = identToken.Name;
            }

            Symbol method = _globalSymbols.Get(methodName);
            if (method != null && method.Defined && !method.IsExternal) {
                _messages.Error(MessageCode.SUBFUNCDEFINED, String.Format("{0} already defined", methodName));
                SkipToEndOfLine();
                return null;
            }

            // Reset the COMMON indexes for this program unit
            foreach (Symbol sym in _globalSymbols) {
                if (sym.Type == SymType.COMMON) {
                    sym.CommonIndex = 0;
                }
            }

            // New local symbol table for this block
            _localSymbols = new SymbolCollection("Local");
            _hasReturn = false;

            // Parameter list allowed for subroutines and functions, but
            // not the main program.
            Collection<Symbol> parameters = null;
            int alternateReturnCount = 0;

            switch (klass) {
                case SymClass.PROGRAM:
                    parameters = new Collection<Symbol>();
                    klass = SymClass.SUBROUTINE;
                    methodName = _entryPointName;
                    break;

                case SymClass.FUNCTION:
                    parameters = ParseParameterDecl(_localSymbols, SymScope.PARAMETER, out alternateReturnCount);
                    break;

                case SymClass.SUBROUTINE:
                    parameters = ParseParameterDecl(_localSymbols, SymScope.PARAMETER, out alternateReturnCount);
                    if (alternateReturnCount > 0) {
                        returnType = new SymFullType(SymType.INTEGER);
                    }
                    break;
            }

            // Don't allow alternate returns for anything except subroutines
            if (alternateReturnCount > 0 && klass != SymClass.SUBROUTINE) {
                _messages.Error(MessageCode.ALTRETURNNOTALLOWED, "Alternate return only permitted for subroutines");
            }

            // Add this method to the global symbol table now.
            if (method == null) {
                method = _globalSymbols.Add(methodName, new SymFullType(), klass, null, _ls.LineNumber);
            }

            method.Parameters = parameters;
            method.Defined = true;
            method.Class = klass;

            if (returnType.Type != SymType.NONE) {
                method.FullType = returnType;
            }

            if (methodName == _entryPointName) {
                method.Modifier |= SymModifier.ENTRYPOINT;
                _hasProgram = true;
            }

            // Special case for functions. Create a local symbol with the same
            // name to be used for the return value.
            if (klass == SymClass.FUNCTION || alternateReturnCount > 0) {
                method.RetVal = _localSymbols.Add(methodName, returnType, SymClass.VAR, null, _ls.LineNumber);
                method.RetVal.Modifier = SymModifier.RETVAL;
            }

            node.ProcedureSymbol = method;
            node.LocalSymbols = _localSymbols;
            node.LabelList = new Collection<ParseNode>();

            _currentProcedure = node;
            _currentProcedure.AlternateReturnCount = alternateReturnCount;

            _initList = new CollectionParseNode();
            node.InitList = _initList;

            // Compile the body of the procedure
            SimpleToken token = _ls.GetKeyword();
            while (token.ID != TokenID.ENDOFFILE) {
                if (token.ID != TokenID.EOL) {
                    ParseNode labelNode = CheckLabel();
                    if (labelNode != null) {
                        node.Add(labelNode);
                    }
                    if (token.ID == TokenID.KEND) {
                        break;
                    }
                    ParseNode lineNode = Statement(token);
                    if (lineNode != null) {
                        node.Add(MarkLine());
                        node.Add(lineNode);
                    }
                    ExpectEndOfLine();
                }
                token = _ls.GetKeyword();
            }

            // If we hit the end of the file first then we're missing
            // a mandatory END statement.
            if (token.ID != TokenID.KEND) {
                _messages.Error(MessageCode.MISSINGENDSTATEMENT, "Missing END statement");
            }

            // Make sure we have a RETURN statement.
            if (!_hasReturn) {
                node.Add(new ReturnParseNode());
            }

            // Validate the block.
            foreach (Symbol sym in _localSymbols) {
                if (sym.IsLabel && !sym.Defined) {
                    _messages.Error(MessageCode.UNDEFINEDLABEL, sym.RefLine, String.Format("Undefined label {0}", sym.Name));
                }
                if (_saveAll && sym.IsLocal) {
                    sym.Modifier |= SymModifier.STATIC;
                }

                // For non-array characters, if there's no value, set the empty string
                if (sym.Type == SymType.FIXEDCHAR && !sym.IsArray && !sym.Value.HasValue) {
                    sym.Value = new Variant(string.Empty);
                }

                if (!sym.IsReferenced && !(sym.Modifier.HasFlag(SymModifier.RETVAL))) {
                    string scopeName = (sym.IsParameter) ? "parameter" : (sym.IsLabel) ? "label" : "variable";
                    _messages.Warning(MessageCode.UNUSEDVARIABLE,
                                      3,
                                      sym.RefLine,
                                      String.Format("Unused {0} {1} in function", scopeName, sym.Name));
                }
            }
            ValidateBlock(0, node);
            _state = BlockState.SPECIFICATION;
            return node;
        }
Example #51
0
 private static void AddValue(SymbolCollection symbols, string strRep, FeatureSymbol value)
 {
     Symbol symbol;
     if (symbols.TryGetValue(strRep, out symbol))
         AddValue(symbols, symbol, value);
 }
Example #52
0
        // Parse a statement function.
        // We basically save the generated expression parse tree in the symbol
        // to be inserted whenever a reference to the statement function is made.
        ParseNode KStatementFunction(IdentifierToken identToken)
        {
            string methodName = identToken.Name;
            Symbol method = _localSymbols.Get(methodName);
            if (method != null && method.Defined && method.IsMethod) {
                _messages.Error(MessageCode.SUBFUNCDEFINED, String.Format("Statement function {0} already defined", methodName));
                SkipToEndOfLine();
                return null;
            }

            // Create a special symbol table just for this statement function
            _stfSymbols = new SymbolCollection(_localSymbols);

            // Parameter list expected
            int altReturnCount = 0;
            Collection<Symbol> parameters = ParseParameterDecl(_stfSymbols, SymScope.LOCAL, out altReturnCount);
            if (altReturnCount > 0) {
                _messages.Error(MessageCode.ALTRETURNNOTALLOWED, "Alternate return not permitted for statement functions");
            }
            if (method == null) {
                method = _localSymbols.Add(methodName, new SymFullType(), SymClass.FUNCTION, null, _ls.LineNumber);
            }
            method.Class = SymClass.INLINE;
            method.Parameters = parameters;
            method.Linkage = SymLinkage.BYVAL;
            method.Defined = true;

            ExpectToken(TokenID.EQUOP);
            method.InlineValue = Expression();

            // Blow away the temporary symbol table now we're out of scope
            _stfSymbols = null;
            return null;
        }
Example #53
0
 private static void AddValue(SymbolCollection symbols, Symbol symbol, FeatureSymbol value)
 {
     FeatureStruct fs = symbol.FeatureStruct.DeepClone();
     fs.AddValue(value.Feature, value);
     fs.Freeze();
     symbols.Remove(symbol);
     symbols.Add(symbol.StrRep, fs, symbol.Overwrite);
 }
        SymbolCollection<TriggerSymbol> GetTriggers(TransitionDefinitionSyntax transitionDefinitionSyntax) {

            var triggers = new List<TriggerSymbol>();
            
            if (transitionDefinitionSyntax.Trigger != null) {
                _triggers = triggers;
                Visit(transitionDefinitionSyntax.Trigger);
                _triggers = null;
            }
            
            var result = new SymbolCollection<TriggerSymbol>();
            foreach(var trigger in triggers) {
                var existing = result.TryFindSymbol(trigger.Name);
                if(existing != null) {

                    _diagnostics.Add(new Diagnostic(
                        existing.Location, 
                        DiagnosticDescriptors.Semantic.Nav0026TriggerWithName0AlreadyDeclared, 
                        existing.Name));

                    _diagnostics.Add(new Diagnostic(trigger.Location,
                        DiagnosticDescriptors.Semantic.Nav0026TriggerWithName0AlreadyDeclared,
                        trigger.Name));

                } else {
                    result.Add(trigger);
                }
            }

            return result;
        }
Example #55
0
 private bool TryMultipleBaseCharacterSymbol(Match match, SymbolCollection bases, out string strRep, out FeatureStruct fs)
 {
     Group joinerGroup = match.Groups["joiner"];
     Group modGroup = match.Groups["mod"];
     Group consBaseGroup = match.Groups["consBase"];
     Symbol symbol;
     if (joinerGroup.Success && (!modGroup.Success || modGroup.Index >= consBaseGroup.Index + consBaseGroup.Length)
         && bases.TryGetValue(string.Concat(consBaseGroup.Captures.Cast<Capture>().Select(cap => cap.Value)), out symbol))
     {
         var sb = new StringBuilder();
         sb.Append(symbol.StrRep);
         fs = symbol.FeatureStruct != null ? symbol.FeatureStruct.DeepClone() : new FeatureStruct();
         ApplyModifiers(match.Groups["mod"].Captures.Cast<Capture>(), sb, fs);
         strRep = sb.ToString();
         return true;
     }
     strRep = null;
     fs = null;
     return false;
 }
Example #56
0
 /// <summary>
 /// Creates a symbol table parse node with the specified symbol
 /// collection.
 /// </summary>
 /// <param name="symbols">A symbol collection</param>
 public SymbolTableParseNode(SymbolCollection symbols)
 {
     Symbols = symbols;
 }
Example #57
0
 private FeatureStruct BuildFeatStruct(Match match, Capture capture, string baseGroupName, SymbolCollection bases, out string strRep)
 {
     string baseStr = match.Groups[baseGroupName].Captures.Cast<Capture>().Single(cap => capture.Index == cap.Index).Value.ToLowerInvariant();
     FeatureStruct baseFs = bases[baseStr].FeatureStruct;
     FeatureStruct fs = baseFs != null ? baseFs.DeepClone() : new FeatureStruct();
     var sb = new StringBuilder();
     sb.Append(baseStr);
     ApplyModifiers(match.Groups["mod"].Captures.Cast<Capture>().Where(cap => capture.Index <= cap.Index && (capture.Index + capture.Length) >= (cap.Index + cap.Length)), sb, fs);
     strRep = sb.ToString();
     return fs;
 }
 public TaskDeclarationSymbolBuilder(bool processAsIncludedFile) {
     _diagnostics           = new List<Diagnostic>();
     _processAsIncludedFile = processAsIncludedFile;
     _taskDeklarations      = new SymbolCollection<TaskDeclarationSymbol>();
     _includes              = new SymbolCollection<IncludeSymbol>();
 }
Example #59
0
        /// <summary>
        /// Emit the code to generate the referenced symbols from the given symbol
        /// collection. Where a value is specified, we also initialise the symbol
        /// with the given value.
        /// </summary>
        /// <param name="symbols">Symbol collection</param>
        public void GenerateSymbols(SymbolCollection symbols)
        {
            if (symbols == null) {
                throw new ArgumentNullException("symbols");
            }
            foreach (Symbol sym in symbols) {
                if (sym.IsMethod && sym.Defined && !sym.IsParameter) {
                    _prog.CreateMethod(sym);
                    continue;
                }
                if (sym.IsArray) {
                    InitDynamicArray(sym);
                }
                if (sym.IsReferenced) {
                    switch (sym.Type) {
                        case SymType.DOUBLE:
                        case SymType.CHAR:
                        case SymType.FIXEDCHAR:
                        case SymType.INTEGER:
                        case SymType.FLOAT:
                        case SymType.COMPLEX:
                        case SymType.BOOLEAN: {
                            if (sym.IsLocal && !sym.IsIntrinsic && !sym.IsReferenceCommon && !sym.IsMethod) {
                                if (sym.IsFixedStatic) {
                                    sym.Info = _em.CreateFixedStatic(_prog.GetCurrentType(), sym);
                                } else if (sym.IsStatic) {
                                    sym.Info = _em.CreateStatic(_prog.GetCurrentType(), sym);
                                } else {
                                    sym.Index = _em.CreateLocal(sym);
                                }
                                if (sym.IsArray) {
                                    _em.CreateArray(sym);
                                    StoreLocal(sym);
                                    if (sym.Type == SymType.FIXEDCHAR) {
                                        InitFixedStringArray(sym);
                                    }
                                }
                                else if (sym.Type == SymType.FIXEDCHAR) {
                                    _em.CreateString(sym);
                                    StoreLocal(sym);
                                }
                                if (!sym.IsFixedStatic) {
                                    InitialiseSymbol(sym);
                                }
                            }
                            break;
                        }

                        case SymType.LABEL:
                            sym.Info = _em.CreateLabel();
                            break;
                    }
                }
            }
        }
        /// <summary>
        /// Fill auto list with symbols when a blank appears.
        /// This is only required when preceded by the keyword 'function'.
        /// E.g: Function OnCreate...
        /// </summary>
        /// <param name="sciWordBeforeOperator">The word preceding the operator.</param>
        /// <returns>A list of symbols for the current request (maybe null).</returns>
        private SymbolCollection HandleBlank(string sciWordBeforeOperator)
        {
            Scintilla SciControl = _currentDoc.ScintillaControl;
              SymbolCollection list = null;

              if (sciWordBeforeOperator == "function")
              {
            list = new SymbolCollection();

            //add the callbacks which could be defined in addition (filter out already defined)
            foreach (String callback in SciControl.Lexing.Keywords[LUA_PATTERN_CALLBACKS_CLASSES_IDX].Split(new char[] { ' ', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries))
            {
              if (!SciControl.Text.Contains(callback))
            list.Add(new SymbolInfo(callback, SymbolType.CONSTANT));
            }
              }

              return list;
        }