首页 \ 问答 \ Delphi SynEdit无法识别列表中的所有关键字(Python)(Delphi SynEdit does not recognize all Keywords from the list (Python))

Delphi SynEdit无法识别列表中的所有关键字(Python)(Delphi SynEdit does not recognize all Keywords from the list (Python))

我在Delphi XE6应用程序中使用Repository中的SynEdit r117。 我想强调Python代码。

为此,我将一个SynEdit组件放在我的表单上。 另外我在其上添加了组件SynPythonSyn。 我通过Objectinspector连接它们。

现在我可以突出显示一些Python关键字。 经过几个小时的搜索,我打开了Sourcfile SynHighlighterPython.pas,它包含在SynEdit的Package ZIP中。

有一节包含python的所有关键字:

 // List of keywords
  KEYWORDCOUNT = 29;
  KEYWORDS: array [1..KEYWORDCOUNT] of UnicodeString =
    (
    'and',
    'assert',
    'break',
    'class',
    'continue',
    'def',
    'del',
    'elif',
    'else',
    'except',
    'exec',
    'finally',
    'for',
    'from',
    'global',
    'if',
    'import',
    'in',
    'is',
    'lambda',
    'not',
    'or',
    'pass',
    'print',
    'raise',
    'return',
    'try',
    'while',
    'yield'
    ); 

我的问题是,“exec”是最后突出显示的关键字。 “exec”之后列表中的所有其他内容都不会突出显示。

有谁知道什么可能导致这种失败?

谢谢!


I use SynEdit r117 from the Repository in my Delphi XE6 application. I would like to highlight Python code.

For that, I placed a SynEdit Component onto my Form. Additionaly I added the Component SynPythonSyn onto it. I have connected them through the Objectinspector.

Now I am able to highlight SOME Python keywords. After a few hours of searching, I opened the Sourcfile SynHighlighterPython.pas which was included in the Package ZIP of SynEdit.

There is a section with all the Keywords of python:

 // List of keywords
  KEYWORDCOUNT = 29;
  KEYWORDS: array [1..KEYWORDCOUNT] of UnicodeString =
    (
    'and',
    'assert',
    'break',
    'class',
    'continue',
    'def',
    'del',
    'elif',
    'else',
    'except',
    'exec',
    'finally',
    'for',
    'from',
    'global',
    'if',
    'import',
    'in',
    'is',
    'lambda',
    'not',
    'or',
    'pass',
    'print',
    'raise',
    'return',
    'try',
    'while',
    'yield'
    ); 

My problem is, that "exec" is the last highlighted keyword. All other in the list after "exec" will not be highlighted.

Does anyone have any idea what could cause this failure?

Thank you!


原文:https://stackoverflow.com/questions/29576141
更新时间:2023-08-22 14:08

最满意答案

这是我如何去做。 假设您使用的是A列和B列,并且数据从第2行开始。

= B2 + IF(A2 <0.1,10,IF(A2 <= 0.19,9,IF(A2 <= 0.29,8,IF(A2 <0.39,7,IF(A2 <= 0.49,6,IF(A2 < = 0.59,5,IF(A2 <= 0.69,4,IF(A2 <= 0.79,3,IF(A2 <= 0.89,2,IF(A2 <= 0.99,1))))))))))

另外值得注意的是,您说百分比将从0%到100%,但100%不是您的任何数据分支的一部分。

希望这个有效!

在此处输入图像描述


Here's how I would go at it. Assuming you are using columns A and B, and data starts on row2.

=B2+IF(A2<0.1,10,IF(A2<=0.19,9,IF(A2<=0.29,8,IF(A2<0.39,7,IF(A2<=0.49,6,IF(A2<=0.59,5,IF(A2<=0.69,4,IF(A2<=0.79,3,IF(A2<=0.89,2,IF(A2<=0.99,1))))))))))

Also worth noting that you stated the percentages would be from 0% to 100%, yet 100% is not part of any of your data forks.

Hope this works!

enter image description here

相关问答

更多
  • 您可以使用表中的属性创建新矩阵,然后强制转换为data.frame。 不需要apply()循环。 as.data.frame(matrix( sprintf("%.0f%%", myTable*100), nrow(myTable), dimnames = dimnames(myTable) )) # 1 2 3 4 # 2006 20% 10% 25% 40% # 2007 10% 25% 30% 20% # 2008 25% 20% 20% 60% ...
  • 您可以执行以下解决方法来完成此操作: df *= 100 df = pandas.DataFrame(df, dtype=str) df += '%' ew = pandas.ExcelWriter('test.xlsx') df.to_excel(ew) ew.save() You can do the following workaround in order to accomplish this: df *= 100 df = pandas.DataFrame(df, dtype=str) df ...
  • 据我所知,它将从最小小数部分等于或大于0.5%的数字中减去1。 在这种情况下,第二大数字只有0.54%,其他都有更大的数字。 例: 此外,当您的总数达到99%时,您应该选择小于0.5%的最大小数部分的值。 例: 因此,相应地创建算法。 As far as I know it will subtract 1 from the number with the smallest decimal part equal to or larger than 0,5%. In this case the second l ...
  • 这是我如何去做。 假设您使用的是A列和B列,并且数据从第2行开始。 = B2 + IF(A2 <0.1,10,IF(A2 <= 0.19,9,IF(A2 <= 0.29,8,IF(A2 <0.39,7,IF(A2 <= 0.49,6,IF(A2 < = 0.59,5,IF(A2 <= 0.69,4,IF(A2 <= 0.79,3,IF(A2 <= 0.89,2,IF(A2 <= 0.99,1)))))))))) 另外值得注意的是,您说百分比将从0%到100%,但100%不是您的任何数据分支的一部分。 希望这 ...
  • 您可能想要查看SUMPRODUCT。 您可以使用它来匹配一行中的多个单元格,然后将它们相加。 例如 =SUMPRODUCT((A1:A10=2011)*(H1:H10="Retail")*(I1:I10="A")*F1:F10) 只需将字母更改为与工作表匹配的字母即可。 细胞格式类型也很重要。 例如,您看到2011年未加引号,因为它存储为数字。 如果它以文本形式存储,则需要为“2011”。 F对应于您想要总计的列。 在这种情况下,它是十月专栏。 您还可以添加更多条件或减去它。 您还可以在开始日期之前动态添 ...
  • =INDEX(differentworksheet!BN4:BU143,MATCH("*"&G8&"*",differentworksheet!B4:B143,0),MATCH(D18,differentworksheet!BN4:BU4,1)) 将yourworksheet替换为您的工作表名称。 =INDEX(differentworksheet!BN4:BU143,MATCH("*"&G8&"*",differentworksheet!B4:B143,0),MATCH(D18,differentwor ...
  • 转换为对数域(因此您应该得到一条直线,尽管有异常值),然后应用线性回归 。 Convert to the log-domain (so that you should get a straight line, outliers notwithstanding), and then apply linear regression.
  • 这没有意义 - 除非您的互联网连接一次只加载文件的1% 。 发生的事情是,在收到每个新数据包之后,它可以是基于您的下载速度的任何大小(假设介于200和230kb之间)。 每次收到其中一个时调度ProgressEvent.PROGRESS ,添加到您预期的加载总百分比。 所以基本上,假设我们正在加载一个1000kb的文件,你的下载速度是100-150kbps 。 在收到新数据包时,将在每次调度ProgressEvent.PROGRESS时调用函数中的每个trace() ,因此: 100kb装载 - 总共100 ...
  • let x->the number of 20$ tickets and y->the number of 30$ tickets then: x + y = 764 or x = 764 - y we know x*20 + y*30 = 19740 substituting (764 - y) for x (764 - y)*20 + y*30 = 19740 evaluating you get y= 446 now that we know y. x = 764 - y = 318 perce ...
  • 公式将是这样的: =(Price*MinimumNights)+MAX(Booked-Accomodates,0)*ExtraPersonCharge 如果您想包括超过最少夜晚的预订,您可以使用: =(Price*MAX(Days,MinimumNights))+MAX(Booked-Accomodates,0)*ExtraPersonCharge Formula would be something like: =(Price*MinimumNights)+MAX(Booked-Accomodates ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)