parsing

AttributeError: 'MuParser' object has no attribute 'startRule'

我们两清 提交于 2021-02-11 06:44:54
问题 So I copied this code from an SO answer: grammar Mu; parse : block EOF ; block : stat* ; stat : assignment | if_stat | while_stat | log | OTHER {System.err.println("unknown char: " + $OTHER.text);} ; assignment : ID ASSIGN expr SCOL ; if_stat : IF condition_block (ELSE IF condition_block)* (ELSE stat_block)? ; condition_block : expr stat_block ; stat_block : OBRACE block CBRACE | stat ; while_stat : WHILE expr stat_block ; log : LOG expr SCOL ; expr : expr POW<assoc=right> expr #powExpr |

AttributeError: 'MuParser' object has no attribute 'startRule'

断了今生、忘了曾经 提交于 2021-02-11 06:44:08
问题 So I copied this code from an SO answer: grammar Mu; parse : block EOF ; block : stat* ; stat : assignment | if_stat | while_stat | log | OTHER {System.err.println("unknown char: " + $OTHER.text);} ; assignment : ID ASSIGN expr SCOL ; if_stat : IF condition_block (ELSE IF condition_block)* (ELSE stat_block)? ; condition_block : expr stat_block ; stat_block : OBRACE block CBRACE | stat ; while_stat : WHILE expr stat_block ; log : LOG expr SCOL ; expr : expr POW<assoc=right> expr #powExpr |

JSONObject[“sum”] not found while parsing JSON in Java

佐手、 提交于 2021-02-11 06:35:37
问题 I have a problem. I wrote the JSON parsing code, but it gives me an error. I don't understand what the problem is. String result is JSON.I need to output the amount value from sum. Returns an error: "JSONObject["sum"] not found." JSONObject json = new JSONObject(result); JSONObject bpi = json.getJSONObject("sum"); String uuu = bpi.getString ("amount"); System.out.println(uuu); { "data": [ { "txnId": 20071336083, "personId": 1, "date": "2020-10-21T20:10:56+03:00", "errorCode": 0, "error": null

JSONObject[“sum”] not found while parsing JSON in Java

瘦欲@ 提交于 2021-02-11 06:35:20
问题 I have a problem. I wrote the JSON parsing code, but it gives me an error. I don't understand what the problem is. String result is JSON.I need to output the amount value from sum. Returns an error: "JSONObject["sum"] not found." JSONObject json = new JSONObject(result); JSONObject bpi = json.getJSONObject("sum"); String uuu = bpi.getString ("amount"); System.out.println(uuu); { "data": [ { "txnId": 20071336083, "personId": 1, "date": "2020-10-21T20:10:56+03:00", "errorCode": 0, "error": null

Python: Regex or Dictionary

房东的猫 提交于 2021-02-11 01:57:39
问题 I have a DataFrame Column with one long string I would like to Parse. I am new to regex and have not worked with it yet. What I have below only returns the first name.. at best. I am wondering if parsing this string is easier for regex or creating a dictionary to iterate through. Here is what I have at the moment. The order is not always the same (C,W,D,G,UTIL) and I will be writing a for loop to iterate through multiple rows just like this one. import pandas as pd import numpy as np import

Python: Regex or Dictionary

丶灬走出姿态 提交于 2021-02-11 01:54:06
问题 I have a DataFrame Column with one long string I would like to Parse. I am new to regex and have not worked with it yet. What I have below only returns the first name.. at best. I am wondering if parsing this string is easier for regex or creating a dictionary to iterate through. Here is what I have at the moment. The order is not always the same (C,W,D,G,UTIL) and I will be writing a for loop to iterate through multiple rows just like this one. import pandas as pd import numpy as np import

Split a Path and take out only the last part (filename) Powershell

故事扮演 提交于 2021-02-10 19:58:55
问题 I'm very new to powershell and im currently trying to write a script that finds a referenced filepath in a file, takes out only the last part of the path (The filename) and moves it to the same destination like the folder containing it. I have a functional script that does what i want, the only thing left is that its not supposed to look for the whole path of the referenced file. Because the path isnt correct anymore. It should just look for the filename and find and move it. This is my

Importing CSV from URL that has line breaks within one of the fields

筅森魡賤 提交于 2021-02-10 18:44:42
问题 I created a script that imports a CSV file from a URL into a Google Sheet. I have used Utilities.parseCsv(csv) in the past with no problems. However, this particular CSV file contains a field that has multiple line returns (ALT+Enter). This causes the parsed file to create extra rows when it encounters these fields. I think the best approach is to sanitize the CSV file before parsing, but I do not know how to do this. The problem field is 'Description' (Column G). Current Script: function

ANTLR4 Parser issues

十年热恋 提交于 2021-02-10 14:57:30
问题 I'm trying to write parser for c++ style header file and failing to properly configure the parser. Lexer: lexer grammar HeaderLexer; SectionLineComment : LINE_COMMENT_SIGN Section CharacterSequence ; Pragma : POUND 'pragma' ; Section : AT_SIGN 'section' ; Define : POUND 'define' | LINE_COMMENT_SIGN POUND 'define' ; Booleanliteral : False | True ; QuotedCharacterSequence : '"' .*? '"' ; ArraySequence : '{' .*? '}' | '[' .*? ']' ; IntNumber : Digit+ ; DoubleNumber : Digit+ POINT Digit+ | ZERO

ANTLR4 Parser issues

跟風遠走 提交于 2021-02-10 14:55:13
问题 I'm trying to write parser for c++ style header file and failing to properly configure the parser. Lexer: lexer grammar HeaderLexer; SectionLineComment : LINE_COMMENT_SIGN Section CharacterSequence ; Pragma : POUND 'pragma' ; Section : AT_SIGN 'section' ; Define : POUND 'define' | LINE_COMMENT_SIGN POUND 'define' ; Booleanliteral : False | True ; QuotedCharacterSequence : '"' .*? '"' ; ArraySequence : '{' .*? '}' | '[' .*? ']' ; IntNumber : Digit+ ; DoubleNumber : Digit+ POINT Digit+ | ZERO