I wish to compile hSpice pva through emacs.
However, compile-mode does not parse the output properly.
This is the error message the pva compiler generates (the pvaE section):
Parsing include file 'include/constants.vams'
Parsing include file 'include/disciplines.vams'
*pvaE* Syntax error, unsupported syntax or illegal keyword at/before 'vco_cal_dec'
file "/my/path/to/file/veriloga.va", line# 226
(ari_var>=0 ari_var<= 7) : ari_var2=16;
^
This is the compile mode settings that fail to capture the above output:
(defvar verilog-compilation-error-regexp-alist '("^\*pvaE\* .+\n\s+file \"\\(.+\\)\", line# \\([0-9]+\\)" 1 2))
(add-to-list 'compilation-error-regexp-alist verilog-compilation-error-regexp-alist)
Help fixing this regexp will be much appreciated !
The whitespace syntax in your string is wrong. Instead of "\s+" it should be "\\s-+".
Related
When I run a file which is begin with #!/usr/bin/perl -w, I get a error:
syntax error at line 153, near "=~ ?"
I try to add "#!/bin/bash", this error is not append, but I get another
error:
"line 34: syntax error near unexpected token `('"
line 153 in my file:
($output_volume =~ ?^([\S]+).mnc?) && ($base_name = $1) ||
die "sharpen_volume failed: output volume does not appear to be"
." a minc volume.\n";
line34 in my file:
use MNI::Startup qw(nocputimes);
$output_volume =~ ?^([\S]+).mnc?
This used to be valid perl and thus might appear in old code and instructional material.
From perlop:
In the past, the leading m in m?PATTERN? was optional, but omitting it would produce a deprecation warning. As of v5.22.0, omitting it produces a syntax error. If you encounter this construct in older code, you can just add m.
That is Perl code so the first error message is meaningful.
With delimiters other than // in the match operator you must have the explicit m for it, so
$output_volume =~ m?^([\S]+).mnc?
It is only with // delimiters that the m may be omitted; from Regex Quote-Like Operators (perlop)
If "/" is the delimiter then the initial m is optional.
See perlretut for a tutorial introduction to regex and perlre for reference.
Also note that the particular delimiters of ? trigger specific regex behavior in a special case. This is discussed by the end of the documentation section in perlop linked above.
You already have two answers that explain the problem.
? ... ? is no longer valid syntax for a match operator. You need m? ... ? instead.
Until Perl 5.22, your syntax generated a warning. Now it's a fatal error (which is what you are seeing). So I assume you're now running this on a more recent version of Perl.
There are, however, a few other points it is probably worth making.
You say you tried to investigate this by changing the first line of your file from #!/usr/bin/perl -w to #!/bin/bash. I'm not sure how you think this was going to help. This line defines the program that is used to run your code. As you have Perl code, you need to run it with Perl. Trying to run it with bash is very unlikely to be useful.
The m? ... ? (or, formerly, ? ... ?) syntax triggers an obscure and specialised behaviour. It seems to me that this behaviour isn't required in your case, so you can probably change it to the more usual / ... /.
Your regex contains an unescaped dot character. Given that you seem to be extracting the basename from a filename that has an extension, it seems likely that this should be escaped (using \.) so that it matches an actual dot (rather than any character).
If you are using this code to extract a file's basename, then using a regex probably isn't the best approach. Perhaps take a look at File::Basename instead.
Extract the £ (pound) currency symbol and the amount (56) from an html file. It is printing the amount as £56 and prints the currency as Â. How can I print only 56, without the symbol? It is working fine with a $ sign.
Part of the code:
cost= "£56"
currencySymbol = cost[0]
print (currencySymbol, cost[1:])
The output I am getting:
Â: £56
there are many ways that you can do it, you can use split, regex and one method that I did below:
Hope it helps you
import re
cost= "£560,000"
match = re.search(r'([\D]+)([\d,]+)', cost)
output = (match.group(1), match.group(2).replace(',',''))
print (output);
output -->('£', '560000')
check here (https://ideone.com/Y053Vb)
Resolved: i tried to run below code in separate file in eclipse and given error about utf-8.
i search the error and got answer, it is eclipse who is changing unicode style to avoid i used to run in python IDLE, i think we can change unicode in eclipse?.
Thanks to Martijn Pieters
[SyntaxError: Non-UTF-8 code starting with '\x91'
cost= "£56"
currencySymbol = cost[0]
print (currencySymbol, cost[1:])
#resolution :when using file use encoding
#with open('index.html', encoding="UTF-8") as productFile:
I am attempting to port a macro from MASM6 to TASM5 (in IDEAL mode) and I am encountering errors. The macro itself assembles fine, but when I attempt to call it, I receive the following error during assembly:
Error xxx.asm(##) Can't use macro name in expression: M_SWAP16
The macro takes the numeric value from a text macro and performs a byte swap. The macro is generally called with ops that take immediate values or during variable initialization.
MACRO M_swap16 operand
LOCAL result
result = (((operand and 0FFh) shl 8) or ((operand and 0FF00h) shr 8))
exitm %result
ENDM
IPPROTO_TCP EQU 6
.
.
.
mov [protocol], M_swap16(IPPROTO_TCP) ; fails
.
.
.
protocol DW ?
protocol_default DW M_swap16(IPPROTO_TCP) ; fails
It works fine in MASM 6.11. Switching TASM from IDEAL to MASM mode doesn't help. Neither does moving the macro into the EQU statement. Ideas?
Unfortunately TASM5 doesn't appear to support macros returning results to expressions at least according to the last official docs. This is also what the error you are seeing is saying. More specifically, the EXITM directive doesn't take an argument like MASM can regardless of the mode you are in. However TASM's macros can still emit a line of code, so if you aren't worried about passing the expression in to the macro, I propose the following workaround (IDEAL mode):
MACRO M_swap16_EXPRESSION expr,operand
LOCAL result
result = (((operand and 0FFh) shl 8) or ((operand and 0FF00h) shr 8))
expr result
ENDM
The macro above takes an additional argument "expr" as the 1st argument which is the assembly expression you were trying to plug the original expression in. It will perform the assembly-time arithmetic on the operand and emit the final assembly line. It can be used like this:
M_swap16_EXPRESSION <mov [protocol],>,IPPROTO_TCP
...
M_swap16_EXPRESSION <protocol_default DW>,IPPROTO_TCP
I admit its ugly, but it might be the next best thing if you must use TASM.
I have the following .dir-locals.el:
((c++-mode . ((irony-compile-flags-work-dir . "/home/aparulekar/Developer/GamePlay")
(irony-compile-flags . (list "-Igameplay/src"
"-Iexternal-deps/bullet/include"
"-Iexternal-deps/oggvorbis/include"
"-Iexternal-deps/libpng/include"
"-Iexternal-deps/zlib/include"
"-Iexternal-deps/lua/include"
"-Iexternal-deps/glew/include")))))
When I visit any file in that folder, I get the following error:
Directory-local variables error: (wrong-type-argument stringp irony-compile-flags)
Could someone please tell me why I can't assign a list to a directory-local variable?
(This is for https://github.com/sarcasm/irony-mode)
Edit - Anton's answer, plus I had some dir-local unsafe-variable-related suppression going on.
irony-compile-flags is defined as a list of strings (repeat string) in its defcustom form.
In your .dir-locals.el, you've forgotten that you're providing values, not lisp expressions to be evaluated. Hence the list symbol is redundant, and that's what breaks the type check: you're setting irony-compile-flags to a list starting with symbol list. Try this:
((c++-mode . ((irony-compile-flags-work-dir . "/home/aparulekar/Developer/GamePlay")
(irony-compile-flags . ("-Igameplay/src"
"-Iexternal-deps/bullet/include"
"-Iexternal-deps/oggvorbis/include"
"-Iexternal-deps/libpng/include"
"-Iexternal-deps/zlib/include"
"-Iexternal-deps/lua/include"
"-Iexternal-deps/glew/include")))))
I have a c++ project which directory structure like below:
server/
code/
BASE/
Thread/
Log/
Memory/
Net/
cmake/
CMakeList.txt
BASE/
CMakeList.txt
Net/
CMakeList.txt
here is part of /cmake/CMakeList.txt:
MACRO(SUBDIRLIST result curdir)
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
SET(dirlist "")
FOREACH(child ${children})
IF(IS_DIRECTORY ${curdir}/${child})
SET(dirlist ${dirlist} ${child})
ENDIF()
ENDFOREACH()
SET(${result} ${dirlist})
ENDMACRO()
add_subdirectory(Base)
then use macro in /cmake/Base/CMakeList.txt:
SET(SUBDIR, "")
SUBDIRLIST(SUBDIRS, ${BASE_SRC_DIR})
message("SUBDIRS : " ${SUBDIRS})
output:
SUBDIRS :
I check ${dirlist} by output it's value in macro, I get directory list expected,but when message("result " ${result}) after SET(${result} ${dirlist}),I can not get output expected , what's wrong with my CMakeLists.txt?
There are a couple of minor issues here:
In your macro, SET(dirlist "") could be just SET(dirlist). Likewise, SET(SUBDIR, "") could be just SET(SUBDIRS) (I guess "SUBDIR" is a typo and should be "SUBDIRS". Also you don't want the comma in the set command - probably another typo?)
To output the contents of ${result} in the macro, use message("result: ${${result}}"), since you're not appending ${child} to result each time, but to ${result}. In your example ${result} is SUBDIRS, so ${${result}} is ${SUBDIRS}.
When you call SUBDIRLIST, don't use a comma between the arguments.
When you output the value of SUBDIRS, include ${SUBDIRS} in the quotes, i.e. message("SUBDIRS: ${SUBDIRS}") or you'll lose the semi-colon separators.
Other than those, your macro seems fine.