|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.Collections.Generic; |
|
19 using System.Text; |
|
20 using System.Text.RegularExpressions; |
|
21 using System.Reflection; |
|
22 using SymbianParserLib.Elements; |
|
23 using SymbianParserLib.Enums; |
|
24 |
|
25 namespace SymbianParserLib.RegExTranslators.Types |
|
26 { |
|
27 internal class RegExTranslatorString : RegExTranslatorBase |
|
28 { |
|
29 #region Constructors |
|
30 public RegExTranslatorString() |
|
31 { |
|
32 } |
|
33 #endregion |
|
34 |
|
35 #region API |
|
36 public override ParserField Process( Capture aCapture, int aStartAt, ParserLine aLine ) |
|
37 { |
|
38 ParserField ret = null; |
|
39 // |
|
40 RegExTranslatorExtractionInfo m = new RegExTranslatorExtractionInfo( aLine.OriginalValue, aStartAt ); |
|
41 // |
|
42 if ( m.Success && m.ValueType == TParserValueType.EValueTypeString ) |
|
43 { |
|
44 ret = CreateField( ".+", m.Name, m.ValueType, m.CapturePos, m.CaptureLength ); |
|
45 } |
|
46 // |
|
47 return ret; |
|
48 } |
|
49 #endregion |
|
50 |
|
51 #region Properties |
|
52 #endregion |
|
53 |
|
54 #region Internal methods |
|
55 #endregion |
|
56 |
|
57 #region Internal constants |
|
58 #endregion |
|
59 |
|
60 #region From System.Object |
|
61 public override string ToString() |
|
62 { |
|
63 return base.ToString(); |
|
64 } |
|
65 #endregion |
|
66 |
|
67 #region Data members |
|
68 /// <summary> |
|
69 /// Regular expression built for C# on: Thu, May 15, 2008, 01:10:03 PM |
|
70 /// Using Expresso Version: 3.0.2766, http://www.ultrapico.com |
|
71 /// |
|
72 /// A description of the regular expression: |
|
73 /// |
|
74 /// % |
|
75 /// [1]: A numbered capture group. [s|S] |
|
76 /// Select from 2 alternatives |
|
77 /// sS |
|
78 /// |
|
79 /// |
|
80 /// </summary> |
|
81 private static Regex KRegEx = new Regex( |
|
82 "%(s|S)", |
|
83 RegexOptions.IgnoreCase |
|
84 | RegexOptions.CultureInvariant |
|
85 | RegexOptions.IgnorePatternWhitespace |
|
86 | RegexOptions.Compiled |
|
87 ); |
|
88 #endregion |
|
89 } |
|
90 } |