syntax-error

Python: raise SyntaxError with lineno

不羁的心 提交于 2019-12-06 06:36:58
问题 I am implementing a parser for a domain specific language, and want to be able to raise a SyntaxError. How do I set the filename, lineno and offset when raising this exception? exception SyntaxError Raised when the parser encounters a syntax error. This may occur in an import statement, in an exec statement, in a call to the built-in function eval() or input(), or when reading the initial script or standard input (also interactively). Instances of this class have attributes filename, lineno,

Why would whitespace cause a fatal error in PHP?

99封情书 提交于 2019-12-06 02:28:38
I have an associative array that, for all intents and purposes, appears to have absolutely no reason to throw even a warning. The entirety of the source code is as follows: <?php $entries = array( array('date' => '2012-08-12', 'change' => '-19'), array('date' => '2012-08-13', 'change' => '-21'), array('date' => '2012-08-14', 'change' => '-19'), array('date' => '2012-08-15', 'change' => '-17'), ); foreach ($entries as $entry) { print $entry['date'] . ': ' . $entry['change'] . '<br/>'; } To me everything looks fine, however when I go to view the output in my browser, I get the following error

Powershell Missing statement block after if

大城市里の小女人 提交于 2019-12-06 00:08:21
I have the follow code. But there is a {[( )]} missing somewhere. I can't find it. I is in the 'if section. But I dont know why it isnt working If someone can give a tip or something is it will be create. Thanks for reading. $date = (get-date).AddDays(-1).ToString("yyyMMdd") $erroractionpreference = "SilentlyContinue" $Excel = New-Object -comobject Excel.Application $Excel.visible = $True $ExcelSheet = $Excel.Workbooks.Add() $ExcelCell = $ExcelSheet.Worksheets.Item(1) $ExcelCell.Cells.Item(1,1) = "Machine Name" $ExcelCell.Cells.Item(1,2) = "Online" $ExcelCell.Cells.Item(1,3) = "Drive"

JSON Parse error: Unterminated string

谁都会走 提交于 2019-12-05 19:03:55
I've met an usual problem when escaping a quote within the JSON parse function. If the escaped quote is present, in this case 'test"', it causes the following error 'SyntaxError: JSON Parse error: Unterminated string'. var information = JSON.parse('[{"-1":"24","0":"","1":"","2":"","3":"0.0000","4":"","5":"0.00","6":"0.00","7":"1.00","8":"0","9":"false","10":"false","11":[""],"12":"","13":"","14":"test\""}]'); JSON Lint validates the JSON as valid. adeneo You'll have to double escape it, as in "test\\"" var information = JSON.parse('[{"-1":"24","0":"","1":"","2":"","3":"0.0000","4":"","5":"0.00

If Condition in each do Rails

南笙酒味 提交于 2019-12-05 18:20:16
Hi i need to print out just the candidates where active is == 0 here is my code in the view. I can print if active is yes or no.. But in the each do loop i just want to print the active candidates. So how can i add the condition to my each do loop, thanks. <% @candidates.each do |candidate| %> <div id="candidateper"> <div class="avatth" ><div class="avat_min"> <% if candidate.avatar.present? %> <%= link_to (image_tag candidate.avatar.url(:thumb)), (candidate_path(candidate)) %> <% else %> <%= link_to (image_tag ("espanol/playersample.png")), (candidate_path(candidate)) %> <% end %> </div></div

How to disable JSLint ES6 errors with const and let in Adobe Brackets?

人盡茶涼 提交于 2019-12-05 13:45:58
I have Googled and looked through this site everywhere, but I can only find answers for JSHint instead of JSLint. To get rid of the "use function form of use strict" error I add in /*jslint node: true */ . But to disable errors for using const and let I can't seem to find anything. JSHint has esversion: 6 but this doesn't work on JSLint. Use the Preferences API: var PreferencesManager = brackets.getModule("preferences/PreferencesManager"); prefs = PreferencesManager.getExtensionPrefs("jslint"); prefs.set("options.es6", true); Or set it one of the config files: the brackets.json file of the

1318 - Incorrect number of arguments for PROCEDURE

我怕爱的太早我们不能终老 提交于 2019-12-05 12:19:37
DROP PROCEDURE `ModificarUsuario`// CREATE DEFINER=`root`@`localhost` PROCEDURE `ModificarUsuario`( IN `Aid` INT, IN `Aced` VARCHAR(100), IN `Anombre` VARCHAR(100), IN `Acargo` VARCHAR(100), IN `Acedula` VARCHAR(100), IN `Ausuario` VARCHAR(100), IN `Apass` VARCHAR(100), OUT `res` VARCHAR(10) ) BEGIN SELECT COUNT(usuario) INTO res FROM `usuario` WHERE `cedula`=Aced and `id`<>Aid; IF res =0 THEN UPDATE `usuario` SET cedula=Aced, nombre=Anombre, cargo=Acargo, usuario=Ausuario, contrasena=Apass WHERE cedula=Acedula; END IF; END When I use this procedure I get the error "expected 8, got 7." I don't

Why PHP 4.4.9 throws 'Parse error: syntax error, unexpected T_STATIC'? [closed]

孤街浪徒 提交于 2019-12-05 11:41:02
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center . Closed 6 years ago . I just realized the professor Google is unable to present a specific page where I can find out, when static keyword added to PHP 4. Though following the change log for php 4 I can see that it was available since Version 4.0.6 (or before) but why does it

Declaring an array within an entity in VHDL

限于喜欢 提交于 2019-12-05 06:59:08
I'm trying to make a buffer to hold 16, 16-bit wide instructions for a small CPU design. I need a way to load instructions into the buffer from my testbench. So I wanted to use an array of std_logic_vectors to accomplish this. However, I am getting a syntax error and I'm not sure why (or if I'm allowed to do this in VHDL for that matter). The syntax error is at the line where I declare instructions library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity instruction_buffer is port ( reset : in std_logic; instructions : in array(0 to 15) of std_logic_vector(15 downto 0);

Eclipse Indigo PDT does not underline syntax errors

旧时模样 提交于 2019-12-05 05:56:21
I installed Eclipse SDK Indigo and then followed the following instructions to install PDT on it: This is the original solution posted by ben-k link to the topic: Eclipse indigo PDT 3.0 gotcha download "Eclipse Classic" unzip/install to a new folder location (e.g. c:\eclipse-indigo-win32\ go to help->install new software select Indigo - http://download.eclipse.org/releases/indigo from the "Work with" drop down list type "php" in the filter text Select "PHP Development Tools (PDT) SDK Feature select /next/ok/agree/finish etc.. wait for install and restart when prompted to check installation