コード例 #1
0
        public VariableAssignment(string variableName, ListDefinition listDef)
        {
            this.variableName = variableName;

            if (listDef)
            {
                this.listDefinition = AddContent(listDef);
            }

            // List definitions are always global
            isGlobalDeclaration = true;
        }
コード例 #2
0
        public VariableAssignment(Identifier identifier, ListDefinition listDef)
        {
            this.variableIdentifier = identifier;

            if (listDef)
            {
                this.listDefinition = AddContent(listDef);
                this.listDefinition.variableAssignment = this;
            }

            // List definitions are always global
            isGlobalDeclaration = true;
        }
コード例 #3
0
ファイル: Story.cs プロジェクト: ines3000/inkfungus-template
        public ListElementDefinition ResolveListItem(string listName, string itemName, Parsed.Object source = null)
        {
            ListDefinition listDef = null;

            // Search a specific list if we know its name (i.e. the form listName.itemName)
            if (listName != null)
            {
                if (!_listDefs.TryGetValue(listName, out listDef))
                {
                    return(null);
                }

                return(listDef.ItemNamed(itemName));
            }

            // Otherwise, try to search all lists
            else
            {
                ListElementDefinition foundItem         = null;
                ListDefinition        originalFoundList = null;

                foreach (var namedList in _listDefs)
                {
                    var listToSearch   = namedList.Value;
                    var itemInThisList = listToSearch.ItemNamed(itemName);
                    if (itemInThisList)
                    {
                        if (foundItem != null)
                        {
                            Error("Ambiguous item name '" + itemName + "' found in multiple sets, including " + originalFoundList.identifier + " and " + listToSearch.identifier, source, isWarning: false);
                        }
                        else
                        {
                            foundItem         = itemInThisList;
                            originalFoundList = listToSearch;
                        }
                    }
                }

                return(foundItem);
            }
        }