• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Parse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Parse的典型用法代码示例。如果您正苦于以下问题:C# Parse类的具体用法?C# Parse怎么用?C# Parse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Parse类属于命名空间,在下文中一共展示了Parse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PartsShouldReturnCellsWhenTheParseRepresentsARow

 public void PartsShouldReturnCellsWhenTheParseRepresentsARow()
 {
     Parse row = new Parse("<tr><td>one</td><td>two</td><td>three</td></tr>", new string[]{"tr", "td"});
     Assert.AreEqual("one", row.Parts.Body);
     Assert.AreEqual("two", row.Parts.More.Body);
     Assert.AreEqual("three", row.Parts.More.More.Body);
 }
开发者ID:vaibhavsapre,项目名称:fitsharp,代码行数:7,代码来源:ParseTest.cs


示例2: sqlite3IsReadOnly

    /*
    ** Check to make sure the given table is writable.  If it is not
    ** writable, generate an error message and return 1.  If it is
    ** writable return 0;
    */
    static bool sqlite3IsReadOnly( Parse pParse, Table pTab, int viewOk )
    {
      /* A table is not writable under the following circumstances:
      **
      **   1) It is a virtual table and no implementation of the xUpdate method
      **      has been provided, or
      **   2) It is a system table (i.e. sqlite_master), this call is not
      **      part of a nested parse and writable_schema pragma has not
      **      been specified.
      **
      ** In either case leave an error message in pParse and return non-zero.
      */
      if (
         ( IsVirtual( pTab )
          && sqlite3GetVTable( pParse.db, pTab ).pMod.pModule.xUpdate == null )
        || ( ( pTab.tabFlags & TF_Readonly ) != 0
      && ( pParse.db.flags & SQLITE_WriteSchema ) == 0
      && pParse.nested == 0 )
      )
      {
        sqlite3ErrorMsg( pParse, "table %s may not be modified", pTab.zName );
        return true;
      }

#if !SQLITE_OMIT_VIEW
      if ( viewOk == 0 && pTab.pSelect != null )
      {
        sqlite3ErrorMsg( pParse, "cannot modify %s because it is a view", pTab.zName );
        return true;
      }
#endif
      return false;
    }
开发者ID:pragmat1c,项目名称:coolstorage,代码行数:38,代码来源:delete_c.cs


示例3: DoTable

        public void DoTable(Fixture fixture, Parse tables, object[] businessObjects, int right, int wrong, int ignores, int exceptions)
        {
            BusinessObjectRowFixture.objects = businessObjects;
            RunTest(fixture, tables);

            TestUtils.CheckCounts(resultCounts, right, wrong, ignores, exceptions);
        }
开发者ID:GibSral,项目名称:fitsharp,代码行数:7,代码来源:RowFixtureTest.cs


示例4: MarksDifferentStringCellAsWrong

 public void MarksDifferentStringCellAsWrong()
 {
     var cell = new Parse("td", "something else", null, null);
     var fixture = new Fixture {Processor = new Service.Service()};
     fixture.CellOperation.Check(new TypedValue("something"), cell);
     Assert.AreEqual("\n<td class=\"fail\">something else <span class=\"fit_label\">expected</span><hr />something <span class=\"fit_label\">actual</span></td>", cell.ToString());
 }
开发者ID:blueroc2003,项目名称:fitsharp,代码行数:7,代码来源:CellMatching.cs


示例5: DoTable

        public override void DoTable(Parse theTable)
        {
            Parse embeddedTables = GetEmbeddedTables(theTable);
            Parse expectedCell = GetExpectedCell(theTable);

            var writer = new StoryTestCopyWriter();
            var storyTest = new StoryTest(Processor, writer)
                .WithParsedInput(new Parse("div", string.Empty, embeddedTables, null));
            storyTest.Execute(new Service.Service(Processor));

            SetEmbeddedTables(theTable, writer.ResultTables);

            if (expectedCell != null) {
                var actual = new FixtureTable(writer.ResultTables);
                var expected = new FixtureTable(expectedCell.Parts);
                string differences = actual.Differences(expected);
                if (differences.Length == 0) {
                    Right(expectedCell);
                }
                else {
                    Wrong(expectedCell);
                    expectedCell.More = ParseNode.MakeCells(Escape(differences));
                    expectedCell.More.SetAttribute(CellAttribute.Status, TestStatus.Wrong);
                }
            }
        }
开发者ID:DioF,项目名称:fitsharp,代码行数:26,代码来源:SpecifyFixture.cs


示例6: sqlite3BeginWriteOperation

 // Generate VDBE code that prepares for doing an operation that might change the database.
 //
 // This routine starts a new transaction if we are not already within a transaction.  If we are already within a transaction, then a checkpoint
 // is set if the setStatement parameter is true.  A checkpoint should be set for operations that might fail (due to a constraint) part of
 // the way through and which will need to undo some writes without having to rollback the whole transaction.  For operations where all constraints
 // can be checked before any changes are made to the database, it is never necessary to undo a write and the checkpoint should not be set.
 internal static void sqlite3BeginWriteOperation(Parse pParse, int setStatement, int iDb)
 {
     var pToplevel = sqlite3ParseToplevel(pParse);
     sqlite3CodeVerifySchema(pParse, iDb);
     pToplevel.writeMask |= ((yDbMask)1) << iDb;
     pToplevel.isMultiWrite |= (byte)setStatement;
 }
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:13,代码来源:Build+Write.cs


示例7: AssertValuesInBody

 public static void AssertValuesInBody(Parse cell, string[] values)
 {
     foreach (string value in values)
     {
         AssertValueInBody(cell, value);
     }
 }
开发者ID:blueroc2003,项目名称:fitsharp,代码行数:7,代码来源:CellOperatorTest.cs


示例8: Differences

        private static string Differences(Parse theActual, Parse theExpected)
        {
            if (theActual == null) {
                return (theExpected != null ? FormatNodeDifference(theActual, theExpected) : string.Empty);
            }
            if (theExpected == null) {
                return FormatNodeDifference(theActual, theExpected);
            }
            var actualString = theActual.ToString().Replace("\n", string.Empty).Replace("\r", string.Empty);
            var expectedString = theExpected.ToString().Replace("\n", string.Empty).Replace("\r", string.Empty);
            if (actualString == expectedString) return string.Empty;

            var expected = new Expected(theExpected);
            if (theActual.Tag != expected.Node.Tag) {
                return FormatNodeDifference(theActual, expected.Node);
            }
            string result = BodyDifferences(theActual.Body,  expected.Node.Body);
            if (result.Length > 0) {
                return string.Format("in {0} body, {1}", theActual.Tag, result);
            }
            result = Differences(theActual.Parts,  theExpected.Parts);
            if (result.Length > 0) {
                return string.Format("in {0}, {1}", theActual.Tag, result);
            }
            return Differences(theActual.More, theExpected.More);
        }
开发者ID:vaibhavsapre,项目名称:fitsharp,代码行数:26,代码来源:FixtureTable.cs


示例9: Main

        static void Main(string[] args)
        {
            var articles = GetArticles(@"./Articles");
            int index = 0;

            //Get overall most used character in all articles
            var parse = new Parse(articles);
            Console.WriteLine("Overall most used character in articles: " + parse.GetCharacter());
            Console.WriteLine("Character was used: " + parse.GetNumber());

            //Get overall most used character in each articles
            var text = GetNextArticle(articles);
            while (text != null)
            {
                index++;
                var mostUsed = new Parse(text);

                Console.WriteLine("The most used character in article " + index + " : " + mostUsed.GetCharacter() + " repeated " + mostUsed.GetNumber() + " times");

                text = GetNextArticle(articles);
            }

            Console.WriteLine("Press any key to quit");
            Console.ReadLine();
        }
开发者ID:samriddhi,项目名称:StringInspector,代码行数:25,代码来源:Program.cs


示例10: testText

    public void testText()
    {
        string[] tags ={"td"};
        Parse p = new Parse("<td>a&lt;b</td>", tags);
        Assert.AreEqual("a&lt;b", p.body);
        Assert.AreEqual("a<b", p.text());
        p = new Parse("<td>\ta&gt;b&nbsp;&amp;&nbsp;b>c &&&lt;</td>", tags);
        Assert.AreEqual("a>b & b>c &&<", p.text());
        p = new Parse("<td>\ta&gt;b&nbsp;&amp;&nbsp;b>c &&lt;</td>", tags);
        Assert.AreEqual("a>b & b>c &<", p.text());
        p = new Parse("<TD><P><FONT FACE=\"Arial\" SIZE=2>GroupTestFixture</FONT></TD>", tags);
        Assert.AreEqual("GroupTestFixture",p.text());

        Assert.AreEqual("", Parse.htmlToText("&nbsp;"));
        Assert.AreEqual("a b", Parse.htmlToText("a <tag /> b"));
        Assert.AreEqual("a", Parse.htmlToText("a &nbsp;"));
        Assert.AreEqual("a", Parse.htmlToText("\u00a0 a \u00a0"));
        Assert.AreEqual("&nbsp;", Parse.htmlToText("&amp;nbsp;"));
        Assert.AreEqual("1     2", Parse.htmlToText("1 &nbsp; &nbsp; 2"));
        Assert.AreEqual("1     2", Parse.htmlToText("1 \u00a0\u00a0\u00a0\u00a02"));
        Assert.AreEqual("a", Parse.htmlToText("  <tag />a"));
        Assert.AreEqual("a\nb", Parse.htmlToText("a<br />b"));

        Assert.AreEqual("ab", Parse.htmlToText("<font size=+1>a</font>b"));
        Assert.AreEqual("ab", Parse.htmlToText("a<font size=+1>b</font>"));
        Assert.AreEqual("a<b", Parse.htmlToText("a<b"));

        Assert.AreEqual("a\nb\nc\nd", Parse.htmlToText("a<br>b<br/>c<  br   /   >d"));
        Assert.AreEqual("a\nb", Parse.htmlToText("a</p><p>b"));
        Assert.AreEqual("a\nb", Parse.htmlToText("a< / p >   <   p  >b"));
    }
开发者ID:juherr,项目名称:fit,代码行数:31,代码来源:ParseTest.cs


示例11: sqlite3AuthCheck

        /*
        ** Do an authorization check using the code and arguments given.  Return
        ** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY.  If SQLITE_DENY
        ** is returned, then the error count and error message in pParse are
        ** modified appropriately.
        */
        int sqlite3AuthCheck(
Parse *pParse,
int code,
string zArg1,
string zArg2,
string zArg3
)
        {
            sqlite3 db = pParse->db;
            int rc;

            /* Don't do any authorization checks if the database is initialising
            ** or if the parser is being invoked from within sqlite3_declare_vtab.
            */
            if( db->init.busy || IN_DECLARE_VTAB ){
            return SQLITE_OK;
            }

            if( db->xAuth==0 ){
            return SQLITE_OK;
            }
            rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext);
            if( rc==SQLITE_DENY ){
            sqlite3ErrorMsg(pParse, "not authorized");
            pParse->rc = SQLITE_AUTH;
            }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){
            rc = SQLITE_DENY;
            sqliteAuthBadReturnCode(pParse);
            }
            return rc;
        }
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:37,代码来源:auth_c.cs


示例12: testRecursing

 public void testRecursing()
 {
     Parse p = new Parse("leader<table><TR><Td>body</tD></TR></table>trailer");
     Assert.AreEqual(null, p.body);
     Assert.AreEqual(null, p.parts.body);
     Assert.AreEqual("body", p.parts.parts.body);
 }
开发者ID:juherr,项目名称:fit,代码行数:7,代码来源:ParseTest.cs


示例13: testIterating

 public void testIterating()
 {
     Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr></table>trailer");
     Assert.AreEqual("one", p.parts.parts.body);
     Assert.AreEqual("two", p.parts.parts.more.body);
     Assert.AreEqual("three", p.parts.parts.more.more.body);
 }
开发者ID:juherr,项目名称:fit,代码行数:7,代码来源:ParseTest.cs


示例14: MakeCell

 public override Tree<Cell> MakeCell(string text, string tag, IEnumerable<Tree<Cell>> branches) {
     var result = new Parse(tag, text, null, null);
     foreach (var branch in branches) {
         result.Add(branch);
     }
     return result;
 }
开发者ID:GibSral,项目名称:fitsharp,代码行数:7,代码来源:Service.cs


示例15: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Parse myParser = new Parse();
            string[] filenames = { "test1.cir", "multiparams.cir", "test2.cir", "test3.cir", "q2n222a.cir", "missing.cir", "nocircuit.cir",
                                 "shortSubcircuit.cir", "bogusName.cir", "bogusparams1.cir", "firstLineCommentTest.cir", 
                                 "nameCharsTestFail.cir", "nameCharsTestPass.cir", "braceTest.cir" };
            foreach( string filename in filenames )
            {
                try
                {
                    ComponentInfo result = myParser.ParseFile(filename );
                    Console.WriteLine("Parsing file '{0}' found {1}",
                        filename, result.ToString() );
                }
                catch (Exception e)
                {
                    // Let the user know what went wrong.
                    Console.WriteLine("ParseFile( {0} ) error:", filename);
                    Console.WriteLine(e.Message);
                }
            }
            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();

        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:27,代码来源:Program.cs


示例16: DeclareLocal

 public LocalBuilder DeclareLocal(Parse.Statement statement, System.Type type, string name)
 {
     var local = IL.DeclareLocal(type);
     if (!String.IsNullOrEmpty(name) && statement != null)
         local.SetLocalSymInfo(name, statement.Line, statement.LinePos);
     return local;
 }
开发者ID:Ancestry,项目名称:DotQL,代码行数:7,代码来源:MethodContext.cs


示例17: resolveAlias

    /*
    ** 2008 August 18
    **
    ** The author disclaims copyright to this source code.  In place of
    ** a legal notice, here is a blessing:
    **
    **    May you do good and not evil.
    **    May you find forgiveness for yourself and forgive others.
    **    May you share freely, never taking more than you give.
    **
    *************************************************************************
    **
    ** This file contains routines used for walking the parser tree and
    ** resolve all identifiers by associating them with a particular
    ** table and column.
    *************************************************************************
    **  Included in SQLite3 port to C#-SQLite;  2008 Noah B Hart
    **  C#-SQLite is an independent reimplementation of the SQLite software library
    **
    **  SQLITE_SOURCE_ID: 2010-01-05 15:30:36 28d0d7710761114a44a1a3a425a6883c661f06e7
    **
    **  $Header$
    *************************************************************************
    */
    //#include "sqliteInt.h"
    //#include <stdlib.h>
    //#include <string.h>

    /*
    ** Turn the pExpr expression into an alias for the iCol-th column of the
    ** result set in pEList.
    **
    ** If the result set column is a simple column reference, then this routine
    ** makes an exact copy.  But for any other kind of expression, this
    ** routine make a copy of the result set column as the argument to the
    ** TK_AS operator.  The TK_AS operator causes the expression to be
    ** evaluated just once and then reused for each alias.
    **
    ** The reason for suppressing the TK_AS term when the expression is a simple
    ** column reference is so that the column reference will be recognized as
    ** usable by indices within the WHERE clause processing logic.
    **
    ** Hack:  The TK_AS operator is inhibited if zType[0]=='G'.  This means
    ** that in a GROUP BY clause, the expression is evaluated twice.  Hence:
    **
    **     SELECT random()%5 AS x, count(*) FROM tab GROUP BY x
    **
    ** Is equivalent to:
    **
    **     SELECT random()%5 AS x, count(*) FROM tab GROUP BY random()%5
    **
    ** The result of random()%5 in the GROUP BY clause is probably different
    ** from the result in the result-set.  We might fix this someday.  Or
    ** then again, we might not...
    */
    static void resolveAlias(
    Parse pParse,         /* Parsing context */
    ExprList pEList,      /* A result set */
    int iCol,             /* A column in the result set.  0..pEList.nExpr-1 */
    Expr pExpr,       /* Transform this into an alias to the result set */
    string zType          /* "GROUP" or "ORDER" or "" */
    )
    {
      Expr pOrig;           /* The iCol-th column of the result set */
      Expr pDup;            /* Copy of pOrig */
      sqlite3 db;           /* The database connection */

      Debug.Assert( iCol >= 0 && iCol < pEList.nExpr );
      pOrig = pEList.a[iCol].pExpr;
      Debug.Assert( pOrig != null );
      Debug.Assert( ( pOrig.flags & EP_Resolved ) != 0 );
      db = pParse.db;
      if ( pOrig.op != TK_COLUMN && ( zType.Length == 0 || zType[0] != 'G' ) )
      {
        pDup = sqlite3ExprDup( db, pOrig, 0 );
        pDup = sqlite3PExpr( pParse, TK_AS, pDup, null, null );
        if ( pDup == null ) return;
        if ( pEList.a[iCol].iAlias == 0 )
        {
          pEList.a[iCol].iAlias = (u16)( ++pParse.nAlias );
        }
        pDup.iTable = pEList.a[iCol].iAlias;
      }
      else if ( ExprHasProperty( pOrig, EP_IntValue ) || pOrig.u.zToken == null )
      {
        pDup = sqlite3ExprDup( db, pOrig, 0 );
        if ( pDup == null ) return;
      }
      else
      {
        string zToken = pOrig.u.zToken;
        Debug.Assert( zToken != null );
        pOrig.u.zToken = null;
        pDup = sqlite3ExprDup( db, pOrig, 0 );
        pOrig.u.zToken = zToken;
        if ( pDup == null ) return;
        Debug.Assert( ( pDup.flags & ( EP_Reduced | EP_TokenOnly ) ) == 0 );
        pDup.flags2 |= EP2_MallocedToken;
        pDup.u.zToken = zToken;// sqlite3DbStrDup( db, zToken );
      }
//.........这里部分代码省略.........
开发者ID:Belxjander,项目名称:Asuna,代码行数:101,代码来源:resolve_c.cs


示例18: EmitName

        public void EmitName(Parse.Statement statement, string[] components)
        {
            // var nameVar = new Name();
            var nameVar = DeclareLocal(statement, typeof(Name), null);
            IL.Emit(OpCodes.Ldloca, nameVar);
            IL.Emit(OpCodes.Initobj, typeof(Name));

            // <stack> = new string[components.Length];
            IL.Emit(OpCodes.Ldloca, nameVar);
            IL.Emit(OpCodes.Ldc_I4, components.Length);
            IL.Emit(OpCodes.Newarr, typeof(string));

            for (int i = 0; i < components.Length; i++)
            {
                // <stack>[i] = components[i]
                IL.Emit(OpCodes.Dup);
                IL.Emit(OpCodes.Ldc_I4, i);
                IL.Emit(OpCodes.Ldstr, components[i]);
                IL.Emit(OpCodes.Stelem_Ref);
            }

            // nameVar.Components = <stack>
            IL.Emit(OpCodes.Stfld, ReflectionUtility.NameComponents);

            // return nameVar;
            IL.Emit(OpCodes.Ldloc, nameVar);
        }
开发者ID:Ancestry,项目名称:DotQL,代码行数:27,代码来源:MethodContext.cs


示例19: CompileDereference

        protected virtual Expression CompileDereference(Compiler compiler, Frame frame, Expression left, Parse.BinaryExpression expression, System.Type typeHint)
        {
            left = compiler.MaterializeReference(left);

            var local = compiler.AddFrame(frame, expression);
            var memberType = left.Type.GenericTypeArguments[0];
            var parameters = new List<ParameterExpression>();

            var valueParam = compiler.CreateValueParam(expression, local, left, memberType);
            parameters.Add(valueParam);

            var indexParam = compiler.CreateIndexParam(expression, local);
            parameters.Add(indexParam);

            var right =
                compiler.MaterializeReference
                (
                    compiler.CompileExpression(local, expression.Right, typeHint)
                );

            var selection = Expression.Lambda(right, parameters);
            var select =
                typeof(Enumerable).GetMethodExt
                (
                    "Select",
                    new System.Type[] { typeof(IEnumerable<ReflectionUtility.T>), typeof(Func<ReflectionUtility.T, int, ReflectionUtility.T>) }
                );
            select = select.MakeGenericMethod(memberType, selection.ReturnType);
            return Expression.Call(select, left, selection);
        }
开发者ID:jgabb8989,项目名称:DotQL,代码行数:30,代码来源:NaryTypeHandler.cs


示例20: ExpressionContext

 public ExpressionContext(Parse.Expression expression, Type.BaseType type, Characteristic characteristics, Action<MethodContext> emitGet)
 {
     Expression = expression;
     Type = type;
     Characteristics = characteristics;
     EmitGet = emitGet;
 }
开发者ID:Ancestry,项目名称:DotQL,代码行数:7,代码来源:ExpressionContext.cs



注:本文中的Parse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ParseContext类代码示例发布时间:2022-05-24
下一篇:
C# Parity类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap