本文整理汇总了C#中IdList类的典型用法代码示例。如果您正苦于以下问题:C# IdList类的具体用法?C# IdList怎么用?C# IdList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdList类属于命名空间,在下文中一共展示了IdList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: NameInUsingClause
static bool NameInUsingClause(IdList using_, string colName)
{
if (using_ != null)
for (int k = 0; k < using_.Ids.length; k++)
if (string.Compare(using_.Ids[k].Name, colName, StringComparison.OrdinalIgnoreCase) == 0) return true;
return false;
}
开发者ID:BclEx,项目名称:GpuStructs,代码行数:7,代码来源:Walker+Resolve.cs
示例2: checkColumnOverlap
/*
** pEList is the SET clause of an UPDATE statement. Each entry
** in pEList is of the format <id>=<expr>. If any of the entries
** in pEList have an <id> which matches an identifier in pIdList,
** then return TRUE. If pIdList==NULL, then it is considered a
** wildcard that matches anything. Likewise if pEList==NULL then
** it matches anything so always return true. Return false only
** if there is no match.
*/
static int checkColumnOverlap(IdList pIdList, ExprList pEList)
{
int e;
if (pIdList == null || NEVER(pEList == null))
return 1;
for (e = 0; e < pEList.nExpr; e++)
{
if (sqlite3IdListIndex(pIdList, pEList.a[e].zName) >= 0)
return 1;
}
return 0;
}
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:21,代码来源:trigger_c.cs
示例3: RenderResults
public static void RenderResults(HtmlWriter writer, SearchRecord[] records, bool renderUl = true)
{
var visibleCategorizations = CategorizationFolder.GetVisibleCategorizations();
var newsListUrl = Urls.GetMainNewsListUrl();
if (renderUl)
writer.RenderBeginTag(HtmlTextWriterTag.Ul, "news-list");
foreach (var record in records)
{
var date = record.GetDate("date");
writer.RenderBeginTag(HtmlTextWriterTag.Li, "clearfix");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddAttribute(HtmlTextWriterAttribute.Href, record.GetString("url"));
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.RenderFullTag(HtmlTextWriterTag.H3, record.GetString("title"));
writer.RenderEndTag(); // a
if (date != null)
writer.RenderFullTag(HtmlTextWriterTag.Span,
"Publiseret " + record.GetDate("date").Value.ToString("dd-MM-yyyy"), "date");
var categorizations = new IdList(record.GetString("categorizations"));
if (categorizations.Any())
{
RenderCategorizations(writer, categorizations, visibleCategorizations, newsListUrl);
}
writer.RenderBeginTag(HtmlTextWriterTag.A);
var text = record.GetString("summary");
if (text.Length > 150)
text = text.Substring(0, 150);
writer.RenderFullTag(HtmlTextWriterTag.P, text);
writer.RenderEndTag(); // a
writer.RenderEndTag(); // div
writer.RenderEndTag(); // li.clearfix
}
if (renderUl)
writer.RenderEndTag();
}
开发者ID:jeppe-andreasen,项目名称:Umbraco-Public,代码行数:41,代码来源:SiteSearchResultPart.cs
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
AjaxUtil.RegisterPageMethods(this);
if (!string.IsNullOrEmpty(Request.QueryString["frame"]))
{
ClientScript.RegisterStartupScript(Page.GetType(), "editorInitialization", @"
var gridEditorFrame = $('#" + Request.QueryString["frame"] + @"', window.parent.document);
gridEditorFrame.parent().css('clear','both');
", true);
}
editor.Attributes.Add("hiddenId", Request.QueryString["hiddenId"]);
var provider = GetProvider();
var sourceNodes = provider.GetRootNodes().ToList();
var destinationNodes = new List<Node>();
using (CmsContext.Editing)
{
var item = CmsService.Instance.GetItem<Entity>(new Id(Request.QueryString["itemId"]));
var fieldName = Request.QueryString["fieldName"];
var value = new IdList(item[fieldName]);
foreach (var id in value)
{
var node = sourceNodes.Where(n => n.Id == id.ToString()).FirstOrDefault();
if (node != null)
{
sourceNodes.Remove(node);
destinationNodes.Add(node);
}
}
var litSource = new Literal();
litSource.Text = "<ul class=\"srcList listbox\">" + multiListControl.GenerateListBox(sourceNodes) + "</ul>";
multiListControl.Initialize(litSource, destinationNodes);
}
}
开发者ID:Psolow,项目名称:Umbraco-Public,代码行数:37,代码来源:MultiListEditorHandler.aspx.cs
示例5: CreateChildControls
protected override void CreateChildControls()
{
var provider = GetProvider();
using (CmsContext.Editing)
{
var item = CmsService.Instance.GetItem<Entity>(new Id(Request.QueryString["itemId"]));
var fieldName = Request.QueryString["fieldName"];
var value = new IdList(item[fieldName]);
var destinationNodes = value.Select(id => provider.GetNode(id.ToString())).Where(node => node != null).ToArray();
var treeview = new LinqItTreeView();
treeview.Provider = Request.QueryString["provider"];
treeview.ProviderReferenceId = Request.QueryString["itemId"];
var placeholder = new PlaceHolder();
placeholder.Controls.Add(new LiteralControl("<div class=\"srcList \">"));
placeholder.Controls.Add(treeview);
placeholder.Controls.Add(new LiteralControl("</div>"));
multiListControl.Initialize(placeholder, destinationNodes);
}
base.CreateChildControls();
}
开发者ID:Psolow,项目名称:Umbraco-Public,代码行数:24,代码来源:Handler.aspx.cs
示例6: Example3
static string Example3()
{
Pirate p = new Pirate();
StmtList sl1 = new StmtList();
Sub joe = new Sub("joe", sl1);
p.Add(joe);
LocalDecl ld1 = new LocalDecl();
ld1.type = new StringType();
NamedReg name = new NamedReg();
name.name = "name";
IdList idl1 = new IdList();
idl1.Add(name);
ld1.id_list = idl1;
sl1.Add(ld1);
Assign a1 = new Assign();
a1.lval = name;
StringLiteral s1 = new StringLiteral();
s1.value = " Joe!";
a1.rval = s1;
sl1.Add(a1);
Assign a2 = new Assign();
StringLiteral s2 = new StringLiteral();
s2.value = "Hi!";
TmpStringReg tsr0 = new TmpStringReg();
tsr0.number = 0;
a2.lval = tsr0;
a2.rval = s2;
sl1.Add(a2);
Assign a3 = new Assign();
TmpStringReg tsr1 = new TmpStringReg();
tsr1.number = 1;
BinaryCat bc1 = new BinaryCat();
bc1.a = tsr0;
bc1.b = name;
a3.lval = tsr1;
a3.rval = bc1;
sl1.Add(a3);
AssignCat a4 = new AssignCat();
a4.lval = tsr1;
StringLiteral s3 = new StringLiteral();
s3.value = "\n";
a4.rval = s3;
sl1.Add(a4);
CallStmt cs1 = new CallStmt();
Call c1 = new Call();
c1.func = "print";
c1.args = tsr1;
cs1.call = c1;
sl1.Add(cs1);
StringWriter sw = new StringWriter();
PirateWriter pv = new PirateWriter(sw);
DynamicVisitor.accept(p, pv);
return sw.ToString();
}
开发者ID:JasonWilkins,项目名称:visitor-tk,代码行数:80,代码来源:Program.cs
示例7: Example4
static string Example4()
{
StmtList sl1 = new StmtList();
Sub foo = new Sub("foo", sl1);
Pirate p = new Pirate();
p.Add(foo);
ParamDecl pd1 = new ParamDecl();
pd1.type = new IntType();
IdList idl1 = new IdList();
NamedReg n = new NamedReg();
n.name = "n";
idl1.Add(n);
pd1.id_list = idl1;
sl1.Add(pd1);
ParamDecl pd2 = new ParamDecl();
pd2.type = new StringType();
IdList idl2 = new IdList();
NamedReg message = new NamedReg();
message.name = "message";
idl2.Add(message);
pd2.id_list = idl2;
sl1.Add(pd2);
StringWriter sw = new StringWriter();
PirateWriter pv = new PirateWriter(sw);
DynamicVisitor.accept(p, pv);
return sw.ToString();
}
开发者ID:JasonWilkins,项目名称:visitor-tk,代码行数:40,代码来源:Program.cs
示例8: sqlite3Insert
static void sqlite3Insert(
Parse pParse, /* Parser context */
SrcList pTabList, /* Name of table into which we are inserting */
ExprList pList, /* List of values to be inserted */
Select pSelect, /* A SELECT statement to use as the data source */
IdList pColumn, /* Column names corresponding to IDLIST. */
int onError /* How to handle constraint errors */
)
{
sqlite3 db; /* The main database structure */
Table pTab; /* The table to insert into. aka TABLE */
string zTab; /* Name of the table into which we are inserting */
string zDb; /* Name of the database holding this table */
int i = 0;
int j = 0;
int idx = 0; /* Loop counters */
Vdbe v; /* Generate code into this virtual machine */
Index pIdx; /* For looping over indices of the table */
int nColumn; /* Number of columns in the data */
int nHidden = 0; /* Number of hidden columns if TABLE is virtual */
int baseCur = 0; /* VDBE VdbeCursor number for pTab */
int keyColumn = -1; /* Column that is the INTEGER PRIMARY KEY */
int endOfLoop = 0; /* Label for the end of the insertion loop */
bool useTempTable = false; /* Store SELECT results in intermediate table */
int srcTab = 0; /* Data comes from this temporary cursor if >=0 */
int addrInsTop = 0; /* Jump to label "D" */
int addrCont = 0; /* Top of insert loop. Label "C" in templates 3 and 4 */
int addrSelect = 0; /* Address of coroutine that implements the SELECT */
SelectDest dest; /* Destination for SELECT on rhs of INSERT */
int iDb; /* Index of database holding TABLE */
Db pDb; /* The database containing table being inserted into */
bool appendFlag = false; /* True if the insert is likely to be an append */
/* Register allocations */
int regFromSelect = 0; /* Base register for data coming from SELECT */
int regAutoinc = 0; /* Register holding the AUTOINCREMENT counter */
int regRowCount = 0; /* Memory cell used for the row counter */
int regIns; /* Block of regs holding rowid+data being inserted */
int regRowid; /* registers holding insert rowid */
int regData; /* register holding first column to insert */
int regEof = 0; /* Register recording end of SELECT data */
int[] aRegIdx = null; /* One register allocated to each index */
#if !SQLITE_OMIT_TRIGGER
bool isView = false; /* True if attempting to insert into a view */
Trigger pTrigger; /* List of triggers on pTab, if required */
int tmask = 0; /* Mask of trigger times */
#endif
db = pParse.db;
dest = new SelectDest();// memset( &dest, 0, sizeof( dest ) );
if ( pParse.nErr != 0 /*|| db.mallocFailed != 0 */ )
{
goto insert_cleanup;
}
/* Locate the table into which we will be inserting new information.
*/
Debug.Assert( pTabList.nSrc == 1 );
zTab = pTabList.a[0].zName;
if ( NEVER( zTab == null ) )
goto insert_cleanup;
pTab = sqlite3SrcListLookup( pParse, pTabList );
if ( pTab == null )
{
goto insert_cleanup;
}
iDb = sqlite3SchemaToIndex( db, pTab.pSchema );
Debug.Assert( iDb < db.nDb );
pDb = db.aDb[iDb];
zDb = pDb.zName;
#if NO_SQLITE_OMIT_AUTHORIZATION //#if !SQLITE_OMIT_AUTHORIZATION
if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab.zName, 0, zDb) ){
goto insert_cleanup;
}
#endif
/* Figure out if we have any triggers and if the table being
** inserted into is a view
*/
#if !SQLITE_OMIT_TRIGGER
pTrigger = sqlite3TriggersExist( pParse, pTab, TK_INSERT, null, out tmask );
isView = pTab.pSelect != null;
#else
Trigger pTrigger = null; //# define pTrigger 0
int tmask = 0; //# define tmask 0
bool isView = false;
#endif
#if SQLITE_OMIT_VIEW
//# undef isView
isView = false;
#endif
#if !SQLITE_OMIT_TRIGGER
Debug.Assert( ( pTrigger != null && tmask != 0 ) || ( pTrigger == null && tmask == 0 ) );
#endif
#if !SQLITE_OMIT_VIEW
/* If pTab is really a view, make sure it has been initialized.
** ViewGetColumnNames() is a no-op if pTab is not a view (or virtual
//.........这里部分代码省略.........
开发者ID:Gillardo,项目名称:Cordova-SQLitePlugin,代码行数:101,代码来源:insert_c.cs
示例9: sqlite3IdListDup
static IdList sqlite3IdListDup( sqlite3 db, IdList p )
{
IdList pNew;
int i;
if ( p == null )
return null;
pNew = new IdList();//sqlite3DbMallocRaw(db, sizeof(*pNew) );
if ( pNew == null )
return null;
pNew.nId = pNew.nAlloc = p.nId;
pNew.a = new IdList_item[p.nId];//sqlite3DbMallocRaw(db, p.nId*sizeof(p.a[0]) );
if ( pNew.a == null )
{
sqlite3DbFree( db, ref pNew );
return null;
}
for ( i = 0; i < p.nId; i++ )
{
pNew.a[i] = new IdList_item();
IdList_item pNewItem = pNew.a[i];
IdList_item pOldItem = p.a[i];
pNewItem.zName = pOldItem.zName;// sqlite3DbStrDup(db, pOldItem.zName);
pNewItem.idx = pOldItem.idx;
}
return pNew;
}
开发者ID:laboratoryyingong,项目名称:BARLESS,代码行数:26,代码来源:expr_c.cs
示例10: TriggerInsertStep
public static TriggerStep TriggerInsertStep(Context ctx, Token tableName, IdList column, ExprList list, int null_5, OE orconf) { return TriggerInsertStep(ctx, tableName, column, list, null, orconf); }
开发者ID:BclEx,项目名称:GpuStructs,代码行数:1,代码来源:Trigger.cs
示例11: sqlite3TriggerInsertStep
/*
** Build a trigger step out of an INSERT statement. Return a pointer
** to the new trigger step.
**
** The parser calls this routine when it sees an INSERT inside the
** body of a trigger.
*/
// OVERLOADS, so I don't need to rewrite parse.c
private static TriggerStep sqlite3TriggerInsertStep(sqlite3 db, Token pTableName, IdList pColumn, int null_4, int null_5, u8 orconf)
{
return sqlite3TriggerInsertStep(db, pTableName, pColumn, null, null, orconf);
}
开发者ID:broettge,项目名称:MatterControl,代码行数:13,代码来源:trigger_c.cs
示例12: sqlite3BeginTrigger
/*
** This is called by the parser when it sees a CREATE TRIGGER statement
** up to the point of the BEGIN before the trigger actions. A Trigger
** structure is generated based on the information available and stored
** in pParse.pNewTrigger. After the trigger actions have been parsed, the
** sqlite3FinishTrigger() function is called to complete the trigger
** construction process.
*/
static void sqlite3BeginTrigger(
Parse pParse, /* The parse context of the CREATE TRIGGER statement */
Token pName1, /* The name of the trigger */
Token pName2, /* The name of the trigger */
int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
IdList pColumns, /* column list if this is an UPDATE OF trigger */
SrcList pTableName,/* The name of the table/view the trigger applies to */
Expr pWhen, /* WHEN clause */
int isTemp, /* True if the TEMPORARY keyword is present */
int noErr /* Suppress errors if the trigger already exists */
)
{
Trigger pTrigger = null; /* The new trigger */
Table pTab; /* Table that the trigger fires off of */
string zName = null; /* Name of the trigger */
sqlite3 db = pParse.db; /* The database connection */
int iDb; /* The database to store the trigger in */
Token pName = null; /* The unqualified db name */
DbFixer sFix = new DbFixer(); /* State vector for the DB fixer */
int iTabDb; /* Index of the database holding pTab */
Debug.Assert( pName1 != null ); /* pName1.z might be NULL, but not pName1 itself */
Debug.Assert( pName2 != null );
Debug.Assert( op == TK_INSERT || op == TK_UPDATE || op == TK_DELETE );
Debug.Assert( op > 0 && op < 0xff );
if ( isTemp != 0 )
{
/* If TEMP was specified, then the trigger name may not be qualified. */
if ( pName2.n > 0 )
{
sqlite3ErrorMsg( pParse, "temporary trigger may not have qualified name" );
goto trigger_cleanup;
}
iDb = 1;
pName = pName1;
}
else
{
/* Figure out the db that the the trigger will be created in */
iDb = sqlite3TwoPartName( pParse, pName1, pName2, ref pName );
if ( iDb < 0 )
{
goto trigger_cleanup;
}
}
if ( null == pTableName ) //|| db.mallocFailed
{
goto trigger_cleanup;
}
/* A long-standing parser bug is that this syntax was allowed:
**
** CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab ....
** ^^^^^^^^
**
** To maintain backwards compatibility, ignore the database
** name on pTableName if we are reparsing our of SQLITE_MASTER.
*/
if ( db.init.busy != 0 && iDb != 1 )
{
//sqlite3DbFree( db, pTableName.a[0].zDatabase );
pTableName.a[0].zDatabase = null;
}
/* If the trigger name was unqualified, and the table is a temp table,
** then set iDb to 1 to create the trigger in the temporary database.
** If sqlite3SrcListLookup() returns 0, indicating the table does not
** exist, the error is caught by the block below.
*/
if ( pTableName == null /*|| db.mallocFailed != 0 */ )
{
goto trigger_cleanup;
}
pTab = sqlite3SrcListLookup( pParse, pTableName );
if ( db.init.busy == 0 && pName2.n == 0 && pTab != null
&& pTab.pSchema == db.aDb[1].pSchema )
{
iDb = 1;
}
/* Ensure the table name matches database name and that the table exists */
// if ( db.mallocFailed != 0 ) goto trigger_cleanup;
Debug.Assert( pTableName.nSrc == 1 );
if ( sqlite3FixInit( sFix, pParse, iDb, "trigger", pName ) != 0 &&
sqlite3FixSrcList( sFix, pTableName ) != 0 )
{
goto trigger_cleanup;
}
pTab = sqlite3SrcListLookup( pParse, pTableName );
if ( pTab == null )
{
//.........这里部分代码省略.........
开发者ID:z0rg1nc,项目名称:CsharpSqliteFork,代码行数:101,代码来源:trigger_c.cs
示例13: BeginTrigger
public static void BeginTrigger(Parse parse, Token name1, Token name2, TK trTm, TK op, IdList columns, SrcList tableName, Expr when, bool isTemp, int noErr)
{
Context ctx = parse.Ctx; // The database connection
Debug.Assert(name1 != null); // pName1.z might be NULL, but not pName1 itself
Debug.Assert(name2 != null);
Debug.Assert(op == TK.INSERT || op == TK.UPDATE || op == TK.DELETE);
Debug.Assert(op > 0 && op < (TK)0xff);
Trigger trigger = null; // The new trigger
int db; // The database to store the trigger in
Token name = null; // The unqualified db name
if (isTemp)
{
// If TEMP was specified, then the trigger name may not be qualified.
if (name2.length > 0)
{
parse.ErrorMsg("temporary trigger may not have qualified name");
goto trigger_cleanup;
}
db = 1;
name = name1;
}
else
{
// Figure out the db that the the trigger will be created in
db = parse.TwoPartName(name1, name2, ref name);
if (db < 0)
goto trigger_cleanup;
}
if (tableName == null || ctx.MallocFailed)
goto trigger_cleanup;
// A long-standing parser bug is that this syntax was allowed:
// CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab ....
// ^^^^^^^^
// To maintain backwards compatibility, ignore the database name on pTableName if we are reparsing our of SQLITE_MASTER.
if (ctx.Init.Busy && db != 1)
{
C._tagfree(ctx, ref tableName.Ids[0].Database);
tableName.Ids[0].Database = null;
}
// If the trigger name was unqualified, and the table is a temp table, then set iDb to 1 to create the trigger in the temporary database.
// If sqlite3SrcListLookup() returns 0, indicating the table does not exist, the error is caught by the block below.
//? if (tableName == null) goto trigger_cleanup;
Table table = Delete.SrcListLookup(parse, tableName); // Table that the trigger fires off of
if (ctx.Init.Busy == null && name2.length == 0 && table != null && table.Schema == ctx.DBs[1].Schema)
db = 1;
// Ensure the table name matches database name and that the table exists
if (ctx.MallocFailed) goto trigger_cleanup;
Debug.Assert(tableName.Srcs == 1);
DbFixer sFix = new DbFixer(); // State vector for the DB fixer
if (sFix.FixInit(parse, db, "trigger", name) && sFix.FixSrcList(tableName))
goto trigger_cleanup;
table = Delete.SrcListLookup(parse, tableName);
if (table == null)
{
// The table does not exist.
if (ctx.Init.DB == 1)
{
// Ticket #3810.
// Normally, whenever a table is dropped, all associated triggers are dropped too. But if a TEMP trigger is created on a non-TEMP table
// and the table is dropped by a different database connection, the trigger is not visible to the database connection that does the
// drop so the trigger cannot be dropped. This results in an "orphaned trigger" - a trigger whose associated table is missing.
ctx.Init.OrphanTrigger = true;
}
goto trigger_cleanup;
}
if (E.IsVirtual(table))
{
parse.ErrorMsg("cannot create triggers on virtual tables");
goto trigger_cleanup;
}
// Check that the trigger name is not reserved and that no trigger of the specified name exists
string nameAsString = Parse.NameFromToken(ctx, name);
if (nameAsString == null || parse.CheckObjectName(nameAsString) != RC.OK)
goto trigger_cleanup;
Debug.Assert(Btree.SchemaMutexHeld(ctx, db, null));
if (ctx.DBs[db].Schema.TriggerHash.Find(nameAsString, nameAsString.Length, (Trigger)null) != null)
{
if (noErr == 0)
parse.ErrorMsg("trigger %T already exists", name);
else
{
Debug.Assert(!ctx.Init.Busy);
parse.CodeVerifySchema(db);
}
goto trigger_cleanup;
}
// Do not create a trigger on a system table
if (table.Name.StartsWith("sqlite_", StringComparison.InvariantCultureIgnoreCase))
{
parse.ErrorMsg("cannot create trigger on system table");
parse.Errs++;
goto trigger_cleanup;
}
//.........这里部分代码省略.........
开发者ID:BclEx,项目名称:GpuStructs,代码行数:101,代码来源:Trigger.cs
示例14: SetPreStates
/// <summary>
/// Sets the PRE states of a state transition condition.
/// </summary>
/// <param name="names"></param>
public void SetPreStates(IdList names)
{
StateIndexes.AddRange(Variable.Type.GetIndexesOfNames(names));
PreWildcard = names.Wildcard;
}
开发者ID:thomas13335,项目名称:smg,代码行数:9,代码来源:StateCondition.cs
示例15: CheckColumnOverlap
static bool CheckColumnOverlap(IdList idList, ExprList eList)
{
if (idList == null || C._NEVER(eList == null)) return true;
for (int e = 0; e < eList.Exprs; e++)
if (Expr.IdListIndex(idList, eList.Ids[e].Name) >= 0) return true;
return false;
}
开发者ID:BclEx,项目名称:GpuStructs,代码行数:7,代码来源:Trigger.cs
示例16: Example5
static string Example5()
{
NamedReg x1 = new NamedReg();
x1.name = "x1";
NamedReg x2 = new NamedReg();
x2.name = "x2";
IdList idl1 = new IdList();
idl1.Add(x1);
idl1.Add(x2);
LocalDecl ld1 = new LocalDecl();
ld1.type = new NumType();
ld1.id_list = idl1;
AtomExprList ael1 = new AtomExprList();
ael1.Add(x1);
ael1.Add(x2);
ReturnStmt rs1 = new ReturnStmt();
rs1.rv = ael1;
StmtList sl1 = new StmtList();
sl1.Add(ld1);
sl1.Add(rs1);
Sub abc = new Sub("abc", sl1);
Pirate p = new Pirate();
p.Add(abc);
StringWriter sw = new StringWriter();
PirateWriter pv = new PirateWriter(sw);
DynamicVisitor.accept(p, pv);
return sw.ToString();
}
开发者ID:JasonWilkins,项目名称:visitor-tk,代码行数:39,代码来源:Program.cs
示例17: sqlite3TriggerInsertStep
static TriggerStep sqlite3TriggerInsertStep( sqlite3 db, Token pTableName, IdList pColumn, int null_4, Select pSelect, u8 orconf )
{
return sqlite3TriggerInsertStep( db, pTableName, pColumn, null, pSelect, orconf );
}
开发者ID:z0rg1nc,项目名称:CsharpSqliteFork,代码行数:4,代码来源:trigger_c.cs
示例18: Example2
static string Example2()
{
NamedReg a = new NamedReg("a");
NamedReg b = new NamedReg("b");
NamedReg c = new NamedReg("c");
NamedReg det = new NamedReg("det");
IdList rl1 = new IdList();
rl1.Add(a);
rl1.Add(b);
rl1.Add(c);
rl1.Add(det);
LocalDecl ld1 = new LocalDecl(new NumType(), rl1);
IntLiteral il3 = new IntLiteral(2);
Assign a12 = new Assign(a, il3);
IntLiteral il4 = new IntLiteral(-3);
Assign a13 = new Assign(b, il4);
IntLiteral il5 = new IntLiteral(-2);
Assign a14 = new Assign(c, il5);
UnaryNeg un1 = new UnaryNeg(b);
TmpNumReg tnr0 = new TmpNumReg(0);
Assign a1 = new Assign(tnr0, un1);
TmpNumReg tnr1 = new TmpNumReg(1);
BinaryMul bm1 = new BinaryMul(b, b);
Assign a2 = new Assign(tnr1, bm1);
TmpNumReg tnr2 = new TmpNumReg(2);
IntLiteral il1 = new IntLiteral(4);
BinaryMul bm2 = new BinaryMul(il1, a);
Assign a3 = new Assign(tnr2, bm2);
BinaryMul bm3 = new BinaryMul(tnr2, c);
Assign a4 = new Assign(tnr2, bm3);
TmpNumReg tnr3 = new TmpNumReg(3);
IntLiteral il2 = new IntLiteral(2);
BinaryMul bm4 = new BinaryMul(il2, a);
Assign a5 = new Assign(tnr3, bm4);
BinarySub bs1 = new BinarySub(tnr1, tnr2);
Assign a6 = new Assign(det, bs1);
TmpNumReg tnr4 = new TmpNumReg(4);
Call sqrt = new Call("sqrt", det);
Assign a7 = new Assign(tnr4, sqrt);
NamedReg x1 = new NamedReg("x1");
NamedReg x2 = new NamedReg("x2");
IdList rl2 = new IdList();
rl2.Add(x1);
rl2.Add(x2);
LocalDecl ld2 = new LocalDecl(new NumType(), rl2);
BinaryAdd ba1 = new BinaryAdd(tnr0, tnr4);
Assign a8 = new Assign(x1, ba1);
BinaryDiv bd1 = new BinaryDiv(x1, tnr3);
Assign a9 = new Assign(x1, bd1);
BinarySub bs2 = new BinarySub(tnr0, tnr4);
Assign a10 = new Assign(x2, bs2);
AssignDiv a11 = new AssignDiv(x2, tnr3);
StringLiteral s1 = new StringLiteral("Answers to ABC formula are:\n");
Call c1 = new Call("print", s1);
CallStmt print1 = new CallStmt(c1);
StringLiteral s2 = new StringLiteral("x1 = ");
Call c2 = new Call("print", s2);
CallStmt print2 = new CallStmt(c2);
Call c3 = new Call("print", x1);
CallStmt print3 = new CallStmt(c3);
StringLiteral s4 = new StringLiteral("\nx2 = ");
Call c4 = new Call("print", s4);
CallStmt print4 = new CallStmt(c4);
Call c5 = new Call("print", x2);
CallStmt print5 = new CallStmt(c5);
StringLiteral s6 = new StringLiteral("\n");
Call c6 = new Call("print", s6);
CallStmt print6 = new CallStmt(c6);
StmtList sl1 = new StmtList();
sl1.Add(ld1);
sl1.Add(a12);
sl1.Add(a13);
sl1.Add(a14);
sl1.Add(a1);
//.........这里部分代码省略.........
开发者ID:JasonWilkins,项目名称:visitor-tk,代码行数:101,代码来源:Program.cs
示例19: IdentifierList
void IdentifierList(out IdList list)
{
list = new IdList(); string name;
Identifier(out name);
list.Add(name);
while (la.kind == 14) {
Get();
Identifier(out name);
list.Add(name);
}
}
开发者ID:thomas13335,项目名称:smg,代码行数:11,代码来源:Parser.cs
示例20: StateIdentifierList
void StateIdentifierList(out IdList list)
{
list = null;
if (la.kind == 1) {
IdentifierList(out list);
} else if (la.kind == 31) {
Get();
list = new IdList(true);
} else if (la.kind == 32) {
Get();
list = new IdList("0");
} else if (la.kind == 33) {
Get();
list = new IdList("1");
} else SynErr(43);
}
开发者ID:thomas13335,项目名称:smg,代码行数:16,代码来源:Parser.cs
注:本文中的IdList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论